Arduino IDE Cheat Sheet
Shortcuts for Arduino IDE 2.x on Windows / Linux (macOS: Ctrl → ⌘), plus the most used Arduino functions.
On this page
IDE Shortcuts #
| Shortcut | Action |
|---|---|
Ctrl + R | Verify / compile |
Ctrl + U | Upload |
Ctrl + Shift + U | Upload using a programmer |
Ctrl + Shift + M | Serial Monitor |
Ctrl + T | Auto format |
Ctrl + / | Comment / uncomment |
Ctrl + Space | Autocomplete |
Ctrl + click | Go to definition |
Ctrl + F | Find / replace |
Ctrl + Shift + I | Library Manager |
Ctrl + Shift + B | Boards Manager |
Ctrl + Alt + S | Export compiled binary |
Ctrl + K | Show the sketch folder |
Ctrl + , | Preferences |
Ctrl + N / Ctrl + O / Ctrl + S | New / open / save |
Sketch Structure #
const int LED = 13;
void setup() { // runs once
pinMode(LED, OUTPUT);
Serial.begin(115200);
}
void loop() { // runs forever
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
}
Pins #
| Function | Use |
|---|---|
pinMode(pin, OUTPUT / INPUT / INPUT_PULLUP) | Set the pin mode |
digitalWrite(pin, HIGH / LOW) | Output on / off |
digitalRead(pin) | Read HIGH / LOW |
analogRead(pin) | 0–1023 (Uno, 10-bit) / 0–4095 (ESP32, 12-bit) |
analogWrite(pin, 0–255) | PWM output (LED brightness, motor speed) |
attachInterrupt(digitalPinToInterrupt(pin), isr, RISING) | Run a function on a pin change |
Time #
| Function | Use |
|---|---|
delay(ms) | Pause (blocks everything) |
millis() | Milliseconds since start (non-blocking timing) |
micros() | Microseconds since start |
unsigned long last = 0;
void loop() {
if (millis() - last >= 1000) { // every second, without delay()
last = millis();
Serial.println("tick");
}
}
Serial #
| Function | Use |
|---|---|
Serial.begin(115200) | Start (match the baud rate in the monitor!) |
Serial.print(x) / Serial.println(x) | Print / print + newline |
Serial.printf("T=%.1f\n", t) | Formatted print (ESP32 / ESP8266) |
Serial.available() | Bytes waiting to be read |
Serial.read() / Serial.readStringUntil('\n') | Read input |
Math & Helpers #
| Function | Use |
|---|---|
map(x, 0, 1023, 0, 255) | Re-scale a value |
constrain(x, 0, 100) | Clamp |
random(min, max) | Random number (randomSeed(analogRead(A0)) first) |
tone(pin, freq, ms) / noTone(pin) | Buzzer |
F("text") | Keep strings in flash, saves RAM on AVR |
Communication Libraries #
| Library | Use |
|---|---|
Wire.h | I²C (sensors, OLED displays): Wire.begin() |
SPI.h | SPI (SD cards, TFT displays) |
WiFi.h | Wi-Fi on ESP32 |
EEPROM.h / Preferences.h | Store data permanently (AVR / ESP32) |
Data Types #
| Type | AVR (Uno) | ESP32 |
|---|---|---|
int | 16-bit | 32-bit |
long | 32-bit | 32-bit |
float / double | 32-bit / 32-bit | 32-bit / 64-bit |
uint8_t, int16_t, uint32_t | Exact sizes, use these when it matters |
Boards & Troubleshooting #
| Problem / task | Fix |
|---|---|
| Add ESP32 boards | Preferences → Additional boards URLs: https://espressif.github.io/arduino-esp32/package_esp32_index.json → Boards Manager → install esp32 |
| No port shows up | Install the USB driver (CH340 or CP210x), try another (data) cable |
| ESP32 "Failed to connect" | Hold the BOOT button when "Connecting…" appears |
| Garbage in Serial Monitor | Baud rate doesn't match Serial.begin() |
| Sketch too big / low memory | Use F() strings, smaller types, fewer libraries |
Nothing on this sheet matches “”.