From arduino-cli
This skill should be used when the user asks to "create an Arduino project", "program an Arduino", "write Arduino code", "upload to Arduino", "compile Arduino sketch", "use arduino-cli", "blink an LED", "read a sensor", mentions "microcontroller programming", "embedded development with Arduino", "Arduino Uno", "Arduino Nano", "Arduino Mega", "ESP32 with Arduino", "ESP8266", "Adafruit board", or discusses IoT prototyping, sensor projects, servo control, or Arduino library usage.
How this skill is triggered — by the user, by Claude, or both
Slash command
/arduino-cli:arduino-developmentThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Guidance for Arduino development using the `arduino-cli` command-line tool (v1.4.1).
Guidance for Arduino development using the arduino-cli command-line tool (v1.4.1).
Every Arduino project follows this sequence:
Detect the board: Run arduino-cli board list to identify connected hardware. The output includes the port address and FQBN (Fully Qualified Board Name) needed for all subsequent steps.
Install the platform core: Each board family requires a platform core. Extract the core ID from the FQBN (first two colon-separated segments, e.g., arduino:avr from arduino:avr:uno). Install with arduino-cli core install <core-id>.
Create the sketch: Run arduino-cli sketch new <Name>. This creates a directory with a .ino file containing empty setup() and loop() functions. The directory name must match the .ino filename.
Write the code: Edit the .ino file. Every sketch requires:
void setup() -- runs once at power-on/resetvoid loop() -- runs repeatedly after setupCompile: Run arduino-cli compile --fqbn <FQBN> <sketch-dir>. The output reports flash and RAM usage.
Upload: Run arduino-cli upload -p <port> --fqbn <FQBN> <sketch-dir>. Some boards require pressing a reset button before upload.
Monitor (optional): Run arduino-cli monitor -p <port> to view Serial output. Default baud rate is 9600.
Use these commands for streamlined workflows:
/arduino-new <name> -- Create a new sketch/arduino-build [path] [--fqbn <FQBN>] -- Compile a sketch/arduino-upload [path] -- Upload to a connected board/arduino-boards [search] -- List boards or search for board support/arduino-libs <search | install name> -- Find or install librariesA minimal sketch:
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
Key conventions:
LED_BUILTIN, A0-A5, D0-D13Serial.begin(baud), Serial.println(data)pinMode(), digitalWrite(), digitalRead()analogRead(), analogWrite() (PWM)delay(ms), millis(), micros()millis() over delay() for non-blocking timingFor larger projects, place additional files alongside the .ino:
MyProject/
├── MyProject.ino # Main sketch (must match dir name)
├── sensors.h # Header for sensor module
├── sensors.cpp # Sensor implementation
└── config.h # Configuration constants
All .ino, .c, .cpp, .h files in the sketch directory are automatically compiled together. Use #include "file.h" for local headers.
arduino-cli lib search <keyword>arduino-cli lib install "<Library Name>"arduino-cli lib list#include <LibraryName.h>Boards like ESP32, ESP8266, and Adafruit require additional board manager URLs. Configure with:
arduino-cli config set board_manager.additional_urls <URL1>,<URL2>
Then run arduino-cli core update-index to refresh.
For detailed board-to-FQBN-to-core mappings, consult:
references/board-platforms.md -- Common boards, FQBNs, cores, and board manager URLsFor common compilation and upload errors, consult:
references/troubleshooting.md -- Error diagnosis and fixesFor advanced project structure patterns, consult:
references/project-patterns.md -- State machines, non-blocking timing, multi-file organization--json flag when parsing arduino-cli output programmaticallyboard list command shows Bluetooth and debug serial ports too; only entries with matching_boards in the JSON represent actual Arduino devices/dev/cu.usbmodem* or /dev/cu.usbserial*npx claudepluginhub lookfwd/arduino-cli-claude-plugin --plugin arduino-cliGenerates and troubleshoots ESPHome YAML configs for ESP32 devices including sensor/relay/display templates, GPIO pin assignments, WiFi/OTA setups, and fixes for errors like compilation failures or GPIO conflicts.
Develops STM32 firmware on CubeMX-generated HAL projects with peripheral configuration, BSP driver structure, interrupt-safe code, and hardware-aware troubleshooting.