Linux command
arduino-cli 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List connected boards
arduino-cli board list
Compile a sketch
arduino-cli compile --fqbn [arduino:avr:uno] [path/to/sketch]
Upload a compiled sketch
arduino-cli upload --port [/dev/ttyACM0] --fqbn [arduino:avr:uno] [path/to/sketch]
Compile and upload
arduino-cli compile --fqbn [arduino:avr:uno] --port [/dev/ttyACM0] -u [path/to/sketch]
Create a new sketch
arduino-cli sketch new [MySketch]
Install a board platform
arduino-cli core install [arduino:avr]
Search for a library
arduino-cli lib search [servo]
Install a library
arduino-cli lib install "[Servo]"
Open serial monitor
arduino-cli monitor --port [/dev/ttyACM0]
Update platform index
arduino-cli core update-index && arduino-cli core upgrade
说明
arduino-cli is the official command-line tool for Arduino development. It provides board and library management, sketch compilation, upload functionality, and serial monitoring without requiring the Arduino IDE. The tool uses Fully Qualified Board Names (FQBNs) to identify target boards, formatted as vendor:architecture:board (e.g., arduino:avr:uno). Board platforms must be installed before compiling for them. Typical workflow: install the target platform with core install, compile the sketch with compile, and upload with upload. The --upload flag can be added to compile to perform both steps together. The tool supports custom libraries via --libraries flag, board configuration via --build-property, and integrates well with IDEs like VS Code for Arduino development workflows.
参数
- board list
- List connected Arduino boards with ports and FQBNs
- board listall
- List all known board types
- compile
- Compile an Arduino sketch
- upload
- Upload compiled binaries to a board
- sketch new _name_
- Create a new sketch in the sketchbook
- core install _platform_
- Install a board platform (e.g., arduino:avr)
- core update-index
- Update the platform index
- lib install _name_
- Install a library from the library manager
- lib search _query_
- Search for libraries
- lib list
- List installed libraries
- monitor
- Open serial monitor to communicate with the board
- config init
- Create a default configuration file
- core upgrade
- Upgrade all installed board platforms to the latest version
- -b, --fqbn _string_
- Fully Qualified Board Name (e.g., arduino:avr:uno)
- -p, --port _string_
- Port address (e.g., /dev/ttyACM0 or COM3)
- -u, --upload
- Upload the binary after compilation (use with compile)
- -e, --export-binaries
- Export compiled binaries to the sketch folder
- --output-dir _path_
- Directory for compiled artifacts
- -t, --verify
- Verify uploaded binary after upload
- -v, --verbose
- Enable verbose output during compile or upload
- -P, --programmer _name_
- Use a specific programmer for upload
FAQ
What is the arduino-cli command used for?
arduino-cli is the official command-line tool for Arduino development. It provides board and library management, sketch compilation, upload functionality, and serial monitoring without requiring the Arduino IDE. The tool uses Fully Qualified Board Names (FQBNs) to identify target boards, formatted as vendor:architecture:board (e.g., arduino:avr:uno). Board platforms must be installed before compiling for them. Typical workflow: install the target platform with core install, compile the sketch with compile, and upload with upload. The --upload flag can be added to compile to perform both steps together. The tool supports custom libraries via --libraries flag, board configuration via --build-property, and integrates well with IDEs like VS Code for Arduino development workflows.
How do I run a basic arduino-cli example?
Run `arduino-cli board list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does board list do in arduino-cli?
List connected Arduino boards with ports and FQBNs