blog · 26 November 2026
Debug an Arduino sketch line by line: breakpoints, stepping and live variables
Stop guessing with Serial.print. de:volt's Arduino debugger pauses your sketch on any line and shows every variable, with step over, into and out, and no extra hardware.
When an Arduino sketch misbehaves, most of us do the same thing: sprinkle Serial.print everywhere, upload, squint at the output, and repeat. On real hardware, doing better takes a separate debug probe and some setup. In de:volt, the Uno now has a full debugger built in. Here is how to use it.

A sketch to debug
Drag an Arduino UNO R3 onto the canvas, select it, open the Sketch tab and paste in:
int counter = 0;
byte buf[4] = {1, 2, 3, 4};
void bump(int by) {
counter += by;
}
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
bump(2);
digitalWrite(13, counter % 4 == 0);
buf[0]++;
delay(10);
}Press Upload. The Uno's built-in LED on pin 13 starts flickering, and the sketch runs on happily. Now let's look inside it.
Set a breakpoint
Click in the margin to the left of line 4 (counter += by;). A marker appears: that is a breakpoint. The very next time the Uno reaches that line, the sketch pauses.
Under the editor you will see where the sketch stopped, Paused on line 4 in bump(), along with the variables and their values at that moment, for example:
counter 874
buf {182, 2, 3, 4}Those are the real values in the simulated chip's memory, read the instant it stopped. Expand CPU registers if you want to see the processor itself.
Step through
The buttons above the variables control what happens next:
- Continue runs until the next breakpoint. Press it a few times and watch
counterclimb by 2 each time. - Step over runs the current line and stops on the next one, without going inside function calls.
- Step into follows a function call inside, so from
bump(2);inloop()you land inbump(). - Step out finishes the current function and stops back where it was called.
- Pause stops the sketch wherever it happens to be, even with no breakpoint set.
Click a breakpoint again to remove it. If the sketch was stopped there, it simply carries on running.
A real bug hunt
Here is the kind of thing the debugger makes easy. Change bump(2); to bump(3); and upload. The LED on pin 13 now lights only now and then, because counter % 4 == 0 is true less often. Why? Put a breakpoint on the digitalWrite line and press Continue a few times while watching counter: 3, 6, 9, 12. Only every fourth pass is a multiple of 4. No prints, no re-uploads, just the answer.
Or watch buf[0]. It is a byte, so it counts to 255 and then wraps round to 0. Set a breakpoint, step a few times around that point, and you can see the overflow happen. It is a classic beginner bug, and a perfect thing to show a class.
Why it matters
A debugger turns "why doesn't it work?" into "look, this is where it goes wrong". For students, seeing variables change one line at a time is the fastest way to understand what code actually does. For everyone else, it is simply quicker than Serial.print.
New to Arduino in de:volt? Start with your first sketch and the Serial Monitor, or read everything the new Arduino tools can do.