ESP32-C3 Serial.print() doesn't work!

Hi there,

I’m not really new to Arduino, but this time I’m struggling with the very basics.

After setting up the hardware of a project, I usually start with a simple “blink” to be sure uploading works. Worked. Next comes Serial.print() to put out some debug information. Really a small sketch of less than 10 lines. Doesn’t work.

Where’s the error?

IDE is 2.3.8, I tried the Serial Monitor with 9600 and 115200.

/*
Kuehlkoffer001
Nur Spannungswert an ADC0 bzw. GPIO0 lesen und konvertieren 
*/

const int Spannungspin = 0;

void setup()
{
  Serial.begin(9600);
  delay(1000);
  Serial.println("Kühlkoffer 001");
  pinMode(Spannungspin, INPUT);
  pinMode(8, OUTPUT);
}

void loop()
{
  digitalWrite(8,LOW);
  delay(100);
  digitalWrite(8,HIGH);
  Serial.print("AD-Wert: ");
  Serial.println(analogRead(Spannungspin));
  delay(1000);
}

Appreciate your help.

Tom.

To be precise: Uploading works, the flashing LED works, just the serial messages don’t appear in the Serial Monitor.

Solved by looking at similar problems.

It is necessary not only to choose the right board in the IDE, but also go into the details. Choose Tools → USB CDC on boot → enable.

I was so puzzled because it worked already with another ESP32-C3. But this setting has to be done with every item.

2 Likes

Your topic was using the English language. Therefore it has been moved to one of the English categories.

The IDE doesn't remember it if you have switched to a different board.
Tripped me up many times.

When you develop, to access USB, IDE must first close the serial monitor to free up USB connection..

Once the IDE has finished programming, the microcontroller boots very quickly, too quickly to allow the IDE time to reopen the serial monitor.

The first Serial.print calls are lost unless a delay is added to account for the time it takes to reopen the serial monitor.

If you are using a microcontroller that is already programmed with a serial terminal already running when you connect your board, or if you simply reset the microcontroller with the IDE's serial monitor already open, you will see the first Serial.print calls without needing to add this delay.

During development, I add a delay of 1 to 2 seconds immediately after Serial.begin(115200).
I remove this delay for the final version.