This example will use "~/Arduino/Blink" as its project and an Arduino Uno as the board. If you experience issues while uploading, it might be a problem regarding permissions. Make sure to set the correct permissions for the port your board is connected to (this also applies to Arduino IDE):
$ sudo chmod 666 /dev/ttyACM0
or add your user to the group "dialout":
$ sudo usermod -aG dialout $USER
or if the group dialout does not exist:
$ sudo usermod -aG uucp $USER
Compiling and Uploading
- Compile your sketch: Make sure to specify the right FQDN if you have not configured it as default.
- Upload your sketch: Make sure to specify the right FQDN and port if you have not configured it as default.
$ arduino-cli compile --fqbn arduino:avr:uno ~/Arduino/Blink
$ arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:uno ~/Arduino/Blink