Serial Monitor and Serial Plotter
The Serial Monitor and Serial Plotter in the Arduino IDE are your main tools for seeing what your ESP32 is doing. They let you print text and visualize sensor values in real time.
1. Serial basics
In your sketch you use the Serial object:
Serial.begin(baudRate)– start the serial connection.Serial.print(...)/Serial.println(...)– send text or numbers.
Example:
1 2 3 4 5 6 7 8 9 | |
Open Tools → Serial Monitor and make sure the baud rate in the bottom‑right corner matches the value in Serial.begin(...).
2. Printing sensor values
This example reads an analog sensor (e.g. a potentiometer or LDR) on GPIO 4 and prints the value:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
You should see numbers scrolling in the Serial Monitor when you turn the knob or change the light level.
3. Using the Serial Plotter
The Serial Plotter (Tools → Serial Plotter) draws incoming values as lines over time.
To plot values:
- Print only numbers (optionally labeled) separated by spaces or tabs.
- End each sample with
Serial.println().
Example: plot one channel
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Example: plot two channels
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
4. Debugging tips
-
Nothing appears?
- Check board and port are correct.
- Check baud rate in the Serial Monitor.
- Make sure you called
Serial.begin(...)insetup().
-
Gibberish characters?
- Baud rate mismatch between your sketch and Serial Monitor.
-
Too much data?
- Add
delay(...)in your loop or print less often.
- Add
Using the Serial Monitor and Plotter early in your project can save you a lot of time: always print what your code thinks is happening.