Troubleshooting with the Serial Monitor
Illustrative workshop cover.

Troubleshooting with the Serial Monitor

Find wrong ports, mismatched baud rates and unexpected sensor readings methodically.

The Serial Monitor displays text sent by your sketch. Start with Serial.begin(9600) in setup() and select 9600 baud in the monitor. Print a short startup message so you can distinguish a successful upload from an old sketch still running.

If upload fails, confirm the selected board and port, try a known data-capable USB cable, and disconnect external wiring that could interfere with the board. A charging-only cable will not provide a serial connection. Install USB drivers only from the board or chip vendor when your operating system requires them.

Unreadable characters usually indicate a baud-rate mismatch. No output can mean the wrong port, a missing Serial.begin(), or a program stuck before the print statement. Close other applications holding the serial port, reopen the monitor and press reset to catch startup messages.

Print raw sensor values before adding thresholds or calculations. For analog inputs, record the observed minimum and maximum during a controlled test. For digital sensors, print HIGH or LOW and compare against the module indicator. An unconnected input can float and produce unstable readings.

Repeated startup messages suggest the board may be resetting. Disconnect the actuator supply and retest the controller alone; a motor or servo can cause a supply dip. Change one thing at a time and record the result. Never probe live mains wiring as part of these exercises.

Reference: https://docs.arduino.cc/language-reference/en/functions/communication/serial/