How to display messages in monitor (like Arduino-IDE) with VS-Code + PIO, I got this :
but in the TERMINAL nothing from my serial.print … Is there a way to display an external windows with output message on it ? Thanks !
How to display messages in monitor (like Arduino-IDE) with VS-Code + PIO, I got this :
The Serial
object can point to two different things:
Serial0
aka HardwareSerial
aka UART portUSBSerial
aka HWCDCSerial
aka the builtin native USB portSo try
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1
to route the output of Serial
to the native USB port.
Hello and thanks after .ini modification I was able to compile & run one time, with correct output on TERMINAL windows, now after modification of the loop, I get a compilation error with strange message ?
[env:esp32-c3-devkitc-02]
platform = espressif32
board = esp32-c3-devkitc-02
framework = arduino
lib_deps = NimBLE-Arduino
upload_port = COM8
monitor_port = COM8
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1
Then the main.cpp :
#include <NimBLEDevice.h>
void setup()
{
Serial.begin(9600);
NimBLEDevice::init("MyESP32");
Serial.println("NimBLE initialisé");
}
void loop()
{
Serial.println("Loop started ...");
}
Any idea ?
Seems PIO for ESP32-C3 or C6 is not the good tool, a simple code hang-up it and only solution is to erase the flash :
This is not a “compilation” error. This error is about opening the COM port.
The C3 and C6 are a bit tricky to handle because of their native USB port.
In contrast to UART (USB to Serial), the serial connection to a native USB port is disconnected when the ESP is restarted. As a result, the COM port on the computer disappears briefly and may reappear under a different COM port number. This makes handling somewhat more difficult than, for example, with an ESP32 that is connected via a USB 2 serial chip.
You did not specify the version. Which platform32 version do you actually use?
For the ESP32-C6 you have to use a version that supports Espressif32 Arduino 3.x. Therefore pioarduino is the way to go as the official platform32 will stay at Arduino 2.x. See ESP32-C6-Zero does not work on PlatformIO - #10 by sivar2311
Thanks Boris for your help! Unfortunately I try to use ESP32-C3/6 to connect a normal Bluetooth device (M-Vave Chocolate) this both equipment are not compatible, M-Vave is only BT-Standard and C3 or C6 are only BLE. I stop using Pio because too much complicated for me. It seems that version 2 of the Arduino IDE suits me better. Maybe one day I would come back to its use but for the moment I throw in the towel!