@@ -25,6 +25,104 @@ You may want to copy the executable into a directory which is in your `PATH` env
2525
2626## Usage
2727
28+ The goal of the Arduino CLI is to be used by either including it in Makefile or in any kind of script for the Command Line.
29+ The Arduino CLI aims to replace the majority of features the Arduino IDE has without the graphical UI.
30+
31+ ## Getting Started
32+
33+ ### Step 1. Create a new sketch
34+ The command will create a new empty sketch named MyFirstSketch in the default directory under $HOME/Arduino/
35+
36+ $ arduino-cli sketch new MyFirstSketch
37+ Sketch created in: /home/luca/Arduino/MyFirstSketch
38+
39+ $ cat /home/luca/Arduino/MyFirstSketch/MyFirstSketch.ino
40+ void setup() {
41+ }
42+
43+ void loop() {
44+ }
45+
46+ ### Step 2. Modify your sketch
47+ Use your favourite file editor or IDE to modify the .ino file under: ` $HOME/Arduino/MyFirstSketch/MyFirstSketch.ino `
48+ and change the file to look like this one:
49+
50+ void setup() {
51+ pinMode(LED_BUILTIN, OUTPUT);
52+ }
53+ void loop() {
54+ digitalWrite(LED_BUILTIN, HIGH);
55+ delay(1000);
56+ digitalWrite(LED_BUILTIN, LOW);
57+ delay(1000);
58+ }
59+
60+ ### Step 3. Connect the board to your PC
61+ Just connect the board to your PCs by using the USB cable. In this example we will use the MKR1000 board.
62+
63+ $ arduino-cli board list
64+ FQBN Port ID Board Name
65+ /dev/ttyACM0 2341:804E unknown
66+
67+ the board has been discovered but we do not have the correct core to program it yet. Let's install it!
68+
69+ ### Step 4. Find and install the right core
70+
71+ We have to look at the core available with the ` core search ` command. It will provide a list of available cores matching the name arduino
72+
73+ $ arduino-cli core search arduino
74+ Searching for platforms matching 'arduino'
75+
76+ ID Version Installed Name
77+ Intel:arc32 2.0.2 No Intel Curie Boards
78+ arduino:avr 1.6.21 No Arduino AVR Boards
79+ arduino:nrf52 1.0.2 No Arduino nRF52 Boards
80+ arduino:sam 1.6.11 No Arduino SAM Boards (32-bits ARM Cortex-M3)
81+ arduino:samd 1.6.18 No Arduino SAMD Boards (32-bits ARM Cortex-M0+)
82+ arduino:stm32f4 1.0.1 No Arduino STM32F4 Boards
83+ littleBits:avr 1.0.0 No littleBits Arduino AVR Modules
84+
85+ The right one for the Arduino MKR1000 is arduino: samd , now we can install it
86+
87+ $ arduino-cli core install arduino:samd
88+ Downloading tools...
89+ arduino:arm-none-eabi-gcc@4.8.3-2014q1 downloaded
90+ arduino:bossac@1.7.0 downloaded
91+ arduino:openocd@0.9.0-arduino6-static downloaded
92+ arduino:CMSIS@4.5.0 downloaded
93+ arduino:CMSIS-Atmel@1.1.0 downloaded
94+ arduino:arduinoOTA@1.2.0 downloaded
95+ Downloading cores...
96+ arduino:samd@1.6.18 downloaded
97+ Installing tools...
98+ Installing platforms...
99+ Results:
100+ arduino:samd@1.6.18 - Installed
101+ arduino:arm-none-eabi-gcc@4.8.3-2014q1 - Already Installed
102+ arduino:bossac@1.7.0 - Already Installed
103+ arduino:openocd@0.9.0-arduino6-static - Already Installed
104+ arduino:CMSIS@4.5.0 - Already Installed
105+ arduino:CMSIS-Atmel@1.1.0 - Already Installed
106+ arduino:arduinoOTA@1.2.0 - Already Installed
107+
108+ Now verify we have installed the core properly by running
109+
110+ $ arduino-cli core list
111+ ID Installed Latest Name
112+ arduino:samd 1.6.18 1.6.18 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
113+
114+
115+ We can finally chek if the board is now recognized as a MKR1000
116+
117+ $ arduino-cli board list
118+ FQBN Port ID Board Name
119+ arduino:samd:mkr1000 /dev/ttyACM0 2341:804E Arduino/Genuino MKR1000
120+
121+ Great! Now the Board FQBN (Fully Qualified Board Name) and the Board Name look good, we are ready to compile and upload the sketch
122+
123+ ### Step 5. Compile the sketch
124+ To compile the sketch we have to
125+
28126` arduino-cli ` is a container of commands, to see the full list just run:
29127``` bash
30128$ arduino-cli
0 commit comments