Check one layer at a time: power, connections, raw readings, then application logic. Generated equipment illustration.
Classify the failure before changing code. Compilation errors occur before the program reaches the board. Upload errors involve the selected target, USB connection, bootloader, or port. Runtime errors occur after a successful upload and can be electrical, logical, or timing-related.
Return to a minimal known-good sketch such as Blink. Keep a copy of the failing sketch.
Disconnect external hardware and confirm upload and stable execution.
Add one component, checking its supply and signal levels against its documentation.
Log the raw input before applying filters, conversion, thresholds, or control logic.
Force a known input and predict the exact output. Change one thing at a time.
Record the smallest case that reproduces the fault, including wiring, board, core, library version, and observed messages.
When measuring voltage, connect the meter across the points being compared. Continuity tests are for unpowered circuits. Current measurement is in series and requires the correct meter socket and range; placing an ammeter straight across a supply can short it.
Map symptoms to checks
Symptom
Check first
Useful isolation test
Board lights but no USB port
Data cable and port
Use a known data cable with no peripherals
LED never lights
Pin, polarity, and ground
Test onboard Blink, then external LED wiring
Input changes by itself
Floating pin or loose ground
Use a defined pull-up/down and a short wire
Sensor reads zero
Missing device or invalid conversion
Print raw value plus a separate validity flag
Motor starts and board resets
Supply sag or interference
Disconnect motor and test logic alone
Button responds late
Blocking code or long peripheral calls
Remove delay and measure loop duration
Avoid printing every iteration of a fast loop: a filled transmit buffer can make Serial.print wait and change the timing you are trying to observe. Print at a modest interval or capture a short trace.
Practice: Intentionally select the wrong baud rate, then restore it. Intentionally break an unpowered LED ground connection, reconnect power to observe the fault, then power down and restore it. Learn the symptom without creating a short circuit.
Clean Code: Use descriptive constants instead of magic numbers
Instead of calling digitalWrite(13, HIGH) directly in your code, define descriptive constants like const int LED_PIN = 13; at the top of your file. This makes your code self-documenting and extremely easy to update if you change your wiring.