how to use breakpoints to monitor execution of program

So far, I found there are several ways, one is to use some software simulator, such as virtronics, other ways include using some interfaces/extensions in ides such as visual micro in visual studio code.

But I don't know how stable, practical different methods work. Is there any suggestion?

The most common and very easy to use way to monitor code-execution is to use serial.print-statements

therefore You should use the highest possible baudrate the board is able to use (2000000 baud)

if you have code that has to be executed very fast without beeing delayed by serial.prints
you could use IO-pins to switch on/off LEDs or monitoring the IO-pin with an oscilloscope

If you want to have more insight and your code is not timecritical for a 20-100 milliseconds delay you can use the WaWiLib from sylvestersolutions

It offers an interface with which you can monitor and change variables over serial interface

best regards Stefan

AVR processors do not offer anything in the way of hardware debugging but the ESP32 does allow such debugging with suitable hardware and IDE

StefanL38:
if you have code that has to be executed very fast without beeing delayed by serial.prints

I have dealt with this by writing values to an array (perhaps 100 successive values) and then printing the array.

...R

If you want to stick with Arduino IDE, you are pretty much forced to use Serial.prints and check the values on your serial print, just like StefanL38 already mentioned.

If you are flexible with the IDE, you may try PlatformIO, which has a descent debug possibility out of the box for a lot of Processors, including AVR, so your arduino will probably work.

Visual Studio Code Arduino Plug-in also has an integrated Debugging option. I have no personal experience with that plug-in but, if you feel comfortable to use a powerful yet complicated IDE, go for it :slight_smile: Set up your Debugging (pretty easy, check google) and you are good to go.