Breakpoints are a great way to see how the compiler runs to your code. Now my question is, is there a possibility to use breakpoints when you debug your code?
|
Not in the Arduino IDE. You need to:
There is no provision for debugging through the UART/USB interface using the bootloader. |
|||
|
As noted in Majenko's answer, the Arduino IDE doesn't provide a breakpoint mechanism but Atmel Studio does support breakpoints.[*] However, if you have a switch and an LED, you can track the progress of your program in a way that provides some of the benefits of breakpoints. You would add a subroutine, say [*] Some hardware debuggers modify downloaded code each time breakpoints are added, changed, or removed. That usage will wear out flash memory more rapidly than just occasionally downloading to it. If a chip has been heavily used for such debugging, don't use that chip in a production system. |
|||
|
Though Majenko his answer is correct there are some other options. As to the real hardware debugging as stated by majenko I would say: An other debugging option from a completely different category is to organize your code so that decision logic (hardware independent) and action (hardware dependent ) are completely separated. *Note that your local machine is probably a 32 or 64 bitter and most arduino's are 8 bitters which will result in differences in data types which is an extra attention point when using this method. |
|||
|