Arduino Programming Cheat Sheet



  1. Arduino Codes Pdf
  2. Arduino Programming Language Cheat Sheet
  3. Arduino Programming Cheat Sheet
  4. Arduino Language Reference Pdf
  5. Arduino Commands List

Program Execution

CommandShort formDescription
continuecRun the program
advance setupadv setupRun the program and stop at the beginning of setup() *
nextnExecute the next line of code (step over)
stepsStep into the next line of code
finishfinRun the program until the current function returns (step out)
nextinExecute the next instruction (step over)
stepisiStep into next instruction
untiluLike next, but doesn't go back in loops
Ctrl+CBreak the program at the current instruction
Arduino programming cheat sheet pdf

* The advance command will also stop if the current function returns

Breakpoints

Arduino Cheat Sheet QuicklyCode Arduino is a tool for the design and development of embedded computer systems, consisting of a simple open hardware design for a single-board microcontroller, with embedded I/O support and a standard programming language. Nice Cheat Sheet for Arduino Classroom Tests 😉 I really love cheat sheets. In a lot of cases they can take the place of an entire manual. So I was surprised, given its popularity that I couldn’t find a single-page reference for the arduino online. I tried to make a sheet that captured all the things I hit the reference for while programming. Arduino programming language cheat sheet For many digital products, poor user interface design and UX can sink an app’s fortunes even if the underlying engineering is powerful and innovative. (Remember Color?) But what about the interfaces behind the interface, the ones that developers spend hundreds or thousands of hours interacting with.

Pin Out Diagrams. Arduino C - Cheat Sheet. Cee'z Blog Arduino Timer / PWM cheat sheet. Too low for switch mode power supply (buck converter) and generate audible noise when use for motor or brushless fan (audible tone around 490Hz).

CommandShort formDescription
info breakpointsi bDisplay a list of all the breakpoints
break loopb loopSet a breakpoint at the beginning of loop()
break 42b 42Set a breakpoint in line 42
break *0x156b *0x156Set a breakpoint at program address 0x156
tbreak looptb loopSet a one-time (temporary) breakpoint in loop()
clear loopcl loopDelete any breakpoints on loop()
clear 42cl 42Delete any breakpoints on line 42
delete 1d 1Delete breakpoint number 1
disabledisDisable all breakpoints
disable 1dis 1Disable breakpoint number 1
enableenEnable all breakpoints
enable 1en 1Enable breakpoint number 1
enable once 1en once 1Enable breakpoint number 1 for a single hit

Call Stack

CommandShort formDescription
backtracebtDisplay a backtrace of the current call stack
backtrace -fullbt -fuDisplay backtrace including local variables
info argsi arDump the arguments of the current function
info localsi loDump local variables and their values
info registersi rDump MCU registers
faas info argsfa i arDump the arguments of all functions in the call stack
frame 2f 2Select frame number 2
upGo one stack frame up (e.g. calling function)
downdoGo one stack frame down

Inspecting Code

CommandShort formDescription
list loopl loopShow the source code of loop()
disassembledisasDisassemble the current program location
disassemble/sdisas/sDisassemble including source code
disassemble/rdisas/rDisassemble including opcodes (in hex)
disassemble loopdisas loopDisassemble the loop() function

Inspecting Data

Arduino Codes Pdf

CommandShort formDescription
print $pcp $pcPrint the value of PC (Program Counter)
print $r0p $r0Print the value of the R0 register
print ip iPrint the value of the variable i
print PORTBp PORTBPrint the value of the I/O register PORTB
dprint loop,'Loopn'dp …Print 'Loop' every time loop() starts
dprint loop,'%dn',idp …Print the value of i every time loop() starts
x/16b $spDump 16 memory bytes starting at $sp (stack pointer)
x/10w 0x800200Dump 10 dwords starting at data space address 0x200
x/s 0x800151Dump a string from the data space address 0x151
display someVardisp someVarDisplay the value of someVar whenever the program stops
info displayi diList active auto-display (watch) expressions
delete display 1d d 1Delete auto-display expression number 1

Modifying Data

CommandShort formDescription
set i = 0s i=0Change the value of variable i to 0
set $pc = 0s $pc=0Jump to the beginning of the program
set $r12 = 0x55s $r12=0x55Set r12 to 0x55
set PORTB = 0xffs PORTB=0xffSet PORTB (I/O register) to 0xff
set {int}0x800200 = 50s …Set an integer at dataspace address 0x200 to 50

Text User Interface (TUI)

CommandShort formDescription
tui enabletu eEnabled the TUI mode (also Ctrl X+A)
tui disabletu dEnabled the TUI mode (also Ctrl X+A)
tui reg alltu r aDisplay registers window
layout asmla aSwitch to Assembly view
layout srcla srSwitch to Source Code view
layout splitla spSwitch to Split (Assembly + Source Code) view
updateupdShow the current line in the Source Code window
Ctrl+LRedraw the screen

Other commands

CommandShort formDescription
(empty line)Repeat the previous command
help continueh cShow help about the 'continue' command
help breakh bShow help about the 'break' command
help breakpointsh breakpointsDisplay a list of all breakpoint-related commands
quitqExit GDB (in Wokwi Web GDB, GDB will restart)

Using GDB with the Wokwi Simulator

You can use the Wokwi simulator to play around with GDB and debug your Arduino code.

To start a GDB session, open any project on Wokwi (e.g. this Simon game), click on the code editor, and press F1. In the prompt that opens, type 'GDB':

Arduino Programming Language Cheat Sheet

Then choose one of the options to launch GDB in a new browser tab. In general, the 'debug build' is recommended for optimal debugging experience, but some libraries (e.g. FastLED) may not function correctly without the compiler optimizations.

Arduino Programming Cheat Sheet

I suggest to start with the 'debug build', and switch to the 'release build' only if the program doesn't work correctly.

Arduino Language Reference Pdf

The Web GDB app takes about 30 seconds to start for the first time, and should load within a few seconds after the first time.

When GDB is ready, it should print something like:

At this point, you can write continue to start running the program, advance setup to run the program and stop at the beginning of the setup() function, or any other command from the GDB cheat sheet above.

Arduino Commands List

P.S. if you are curious, here's how I got GDB to run in the browser.