Arduino Quick Reference
Arduino Quick Reference
Core sketch structure, IDE actions, and pin constants at a glance.
Sketch Structure
| void setup() { } | Runs once at power-on or reset ߀” initialise pins, serial, libraries here |
| void loop() { } | Runs repeatedly forever after setup() ߀” your main program logic |
| #include <LibraryName.h> | Include a library at the top of your sketch |
| const int PIN = 9; | Declare a constant ߀” preferred over magic numbers in code |
Time
| delay(ms) | Pause execution for the given number of milliseconds ߀” blocks everything |
| delayMicroseconds(us) | Pause for the given number of microseconds |
| millis() | Returns milliseconds since the board started (unsigned long, overflows after ~49 days) |
| micros() | Returns microseconds since the board started (overflows after ~70 minutes) |
Pin Constants
| LED_BUILTIN | Built-in LED pin number (pin 13 on Uno) |
| HIGH / LOW | Logical 1 (5 V) and logical 0 (0 V) for digital operations |
| INPUT / OUTPUT / INPUT_PULLUP | Pin direction modes used with pinMode() |
| A0 ߀“ A5 | Analog input pin labels (can also be used as digital pins) |
IDE Shortcuts
| Ctrl + R | Verify (compile) the sketch without uploading |
| Ctrl + U | Upload the sketch to the connected board |
| Ctrl + Shift + M | Open the Serial Monitor |
| Ctrl + / | Toggle line comment |