In the debugger the variables are displayed in decimal. Is there a way to switch to hex?
Under the hood, the Arduino IDE integrated debugger is powered by the standard GDB. You can use GDB commands directly from the Debug Console when you require operations not provided by the GUI debugger, or if you just prefer doing things that way.
You can change the default base for numeric display with the set output-radix GDB command:
- From the Arduino IDE's bottom panel, select the "Debug Console" view tab.
- Click on the input field at the bottom of the Debug Console.
- Type the following command:
set output-radix 16 - Press the Enter key.
The change will not take effect immediately in the debugger GUI while it is paused, but the next time the variables are updated they will be displayed in your chosen base.
You can also specify format in the Watch expressions by appending a comma and format specifier to the expressions. For example, if you have a watch expression for a variable named foo, then you could cause it to be formatted as hexidecimal by using the watch expression foo,x.
This is apparently something in the Eclipse Theia/VS Code IDE framework rather than in the debugger extension or Arduino IDE, but I didn't manage to find any definitive documentation about it despite quite a lot of searching. So I don't know the full list of format specifiers, but you can also use b for binary and likely it will be possible to intuit others or find them mentioned in passing in various discussions on the Internet.
Thanks for the post. Where is the "Debug Console" view tab? Is that the one on the left below the library manager?
Thanks but never mind. Found it under an obscure little right arrow or chevron.
John