Debugging Arduino Code

by SommerRobotics in Circuits > Arduino

1306 Views, 1 Favorites, 0 Comments

Debugging Arduino Code

Programino_Arduino_Debugger.png

Debugging Arduino™ Code with the Programino IDE. The easy way to seriall debug Arduino code w/o external hardware.

The Programino IDE debugger for Arduino™ is a powerful and easy to use universal serial inline debugger. It works with all Arduino compatible board, also with the ESP8266, ESP32 or Controllino.

In this example used the Arduino UNO. It does not require any additional hardware to use. The debugger generates its own debug code. This allows variables (even entire functions or calculations) to be viewed at runtime.

Breakpoints allow the programme to be stopped at desired points and to wait until it is continued by the user. In this way, errors and programme sequences can be checked quickly. The annoying insertion of Serial.println() is no longer necessary.

Download Programino IDE:

www.Programino.com


​The Available Debugger Functions:

Programino_Debugger_1.png

Add Breakpoint: Insert breakpoint in the line of the cursor.

Remove Breakpoint: Remove breakpoint in the line of the cursor.

Remove All Breakpoints: Remove all breakpoints in the file.

Add Debug Variable: Add selected variable.

Remove Debug Variable: Remove the marked variable.

Remove All Debug Variable: Remove all debug variables in the file.

Variables and Breakpoints

Programino_Debugger_2.png

With the help of a small example, you can now see how to use the debugger.


To add a debug variable, do the following:

  • Open the example code "\Programino Examples\Debugger".
  • Click with the mouse at the beginning or the end of the variable (in this example first variable is "i" and the second is "t").
  • Press the right mouse button to open the context menu.
  • Select "Add Debug Variable:". The marked variable is displayed in the context menu.
  • The variable then appears in the Debugger Variables window.

To add a breakpoint, do the following:

  • Click with the mouse on the line where the breakpoint is to be inserted.
  • Click with the mouse on the line where the breakpoint is to be inserted.
  • Press the right mouse button to open the context menu.
  • Select "Add Breakpoint".The breakpoint has been set.
  • A red dot with an arrow is displayed at the location of the breakpoint.

2nd File

Programino_Debugger_3.png

Repeat this also in the "2ndFile.ino" of the example as shown in the figure.

Now all variables and breakpoints have been added.

To generate the debug code, press the icon with the "beetle" in the menu above.

The debug code is now generated. The original code is not changed, the debug code is saved in a separate location!

Programino_Debugger_7.png

(1) Generate the debug code.

(2) Start the debugger.

(3) Continue to Breakpoint until the next breakpoint.

(4) Stop debugging.

Starting Debugging

Programino_Debugger.png

Make sure your Arduino™ board is connected to the IDE (Board and Comport).

  • Generate the debug code.
  • After upload the programm to the Arduino™ board, start the programme with the "Play" icon.
  • The programme runs to the first breakpoint and stops there.
  • To continue, click on the icon with the "arrow to the right".
  • The programme continues until the next breakpoint.
  • Continue and watch the output until you have reached the very first breakpoint again.
  • Now you can end the debugger with the "Stop" icon.

The debugger uses the serial interface for communication.

Outputs with serial.print() are also displayed in the right output window during debugging.

Where Is the Debug Code Saved?

Programino_Debugger_18.png

If you press CTRL + SHIFT + W on your keyboard, you can open the path of the debug code.

You can also add whole functions or calculations to the debugger output.
To do this, select the area you want to output and add it as a variable. In the example "analogRead(A0)".

Make Sure That the Brackets Are Also Properly Marked!

Programino_Debugger_13.png

Have fun debugging and experimenting!