@@ -36,7 +36,7 @@ The command will create a new empty sketch named MyFirstSketch in the default di
36
36
$ arduino-cli sketch new MyFirstSketch
37
37
Sketch created in: /home/luca/Arduino/MyFirstSketch
38
38
39
- $ cat /home/luca/Arduino/MyFirstSketch/MyFirstSketch.ino
39
+ $ cat /home/luca/Arduino/MyFirstSketch/MyFirstSketch.ino
40
40
void setup() {
41
41
}
42
42
@@ -48,17 +48,23 @@ Use your favourite file editor or IDE to modify the .ino file under: `$HOME/Ardu
48
48
and change the file to look like this one:
49
49
50
50
void setup() {
51
- pinMode(LED_BUILTIN, OUTPUT);
51
+ pinMode(LED_BUILTIN, OUTPUT);
52
52
}
53
+
53
54
void loop() {
54
- digitalWrite(LED_BUILTIN, HIGH);
55
- delay(1000);
56
- digitalWrite(LED_BUILTIN, LOW);
57
- delay(1000);
55
+ digitalWrite(LED_BUILTIN, HIGH);
56
+ delay(1000);
57
+ digitalWrite(LED_BUILTIN, LOW);
58
+ delay(1000);
58
59
}
59
60
60
61
### 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
+ If you are running a fresh install of the arduino-cli you probably need to update the platform indexes by running:
63
+
64
+ $ arduino-cli core update-index
65
+ Updating index: package_index.json downloaded
66
+
67
+ Now, just connect the board to your PCs by using the USB cable. In this example we will use the MKR1000 board.
62
68
63
69
$ arduino-cli board list
64
70
FQBN Port ID Board Name
@@ -73,57 +79,65 @@ We have to look at the core available with the `core search` command. It will pr
73
79
$ arduino-cli core search arduino
74
80
Searching for platforms matching 'arduino'
75
81
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)
82
+ ID Version Installed Name
83
+ Intel:arc32 2.0.2 No Intel Curie Boards
84
+ arduino:avr 1.6.21 No Arduino AVR Boards
85
+ arduino:nrf52 1.0.2 No Arduino nRF52 Boards
86
+ arduino:sam 1.6.11 No Arduino SAM Boards (32-bits ARM Cortex-M3)
81
87
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
88
+ arduino:stm32f4 1.0.1 No Arduino STM32F4 Boards
89
+ littleBits:avr 1.0.0 No littleBits Arduino AVR Modules
90
+
91
+ If you're unsure you can try to refine the search with the board name
84
92
85
- The right one for the Arduino MKR1000 is arduino: samd , now we can install it
93
+ $ arduino-cli core search mkr1000
94
+ Searching for platforms matching 'mkr1000'
95
+
96
+ ID Version Installed Name
97
+ arduino:samd 1.6.19 No Arduino SAMD Boards (32-bits ARM Cortex-M0+)
98
+
99
+ So, the right platform for the Arduino MKR1000 is arduino: samd , now we can install it
86
100
87
101
$ arduino-cli core install arduino:samd
88
102
Downloading tools...
89
- arduino:arm-none-eabi-gcc@4.8.3-2014q1 downloaded
103
+ arduino:arm-none-eabi-gcc@4.8.3-2014q1 downloaded
90
104
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
105
+ arduino:openocd@0.9.0-arduino6-static downloaded
106
+ arduino:CMSIS@4.5.0 downloaded
107
+ arduino:CMSIS-Atmel@1.1.0 downloaded
108
+ arduino:arduinoOTA@1.2.0 downloaded
95
109
Downloading cores...
96
- arduino:samd@1.6.18 downloaded
110
+ arduino:samd@1.6.19 downloaded
97
111
Installing tools...
98
112
Installing platforms...
99
113
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
114
+ arduino:samd@1.6.19 - Installed
115
+ arduino:arm-none-eabi-gcc@4.8.3-2014q1 - Installed
116
+ arduino:bossac@1.7.0 - Installed
117
+ arduino:openocd@0.9.0-arduino6-static - Installed
118
+ arduino:CMSIS@4.5.0 - Installed
119
+ arduino:CMSIS-Atmel@1.1.0 - Installed
120
+ arduino:arduinoOTA@1.2.0 - Installed
107
121
108
122
Now verify we have installed the core properly by running
109
123
110
124
$ 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+)
125
+ ID Installed Latest Name
126
+ arduino:samd 1.6.19 1.6.19 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
113
127
114
128
115
129
We can finally chek if the board is now recognized as a MKR1000
116
130
117
131
$ arduino-cli board list
118
- FQBN Port ID Board Name
132
+ FQBN Port ID Board Name
119
133
arduino:samd:mkr1000 /dev/ttyACM0 2341:804E Arduino/Genuino MKR1000
120
-
134
+
121
135
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
136
123
137
### Step 5. Compile the sketch
124
138
To compile the sketch we have to run the ` compile ` command with the proper FQBN we just got in the previous command.
125
139
126
- arduino-cli compile --fqbn arduino:samd:mkr1000 Arduino/MyFirstSketch
140
+ $ arduino-cli compile --fqbn arduino:samd:mkr1000 Arduino/MyFirstSketch
127
141
Sketch uses 9600 bytes (3%) of program storage space. Maximum is 262144 bytes.
128
142
129
143
### Step 6. Upload your sketch
@@ -190,7 +204,7 @@ We are now ready to install it! Please be sure to use the full name of the lib a
190
204
191
205
$ arduino-cli lib install "WiFi101"
192
206
Downloading libraries...
193
- WiFi101@0.15.2 downloaded
207
+ WiFi101@0.15.2 downloaded
194
208
Installed WiFi101@0.15.2
195
209
196
210
## Inline Help
@@ -213,11 +227,8 @@ Available Commands:
213
227
core Arduino Core operations.
214
228
help Help about any command
215
229
lib Arduino commands about libraries.
216
- login Creates default credentials for an Arduino Create Session.
217
- logout Clears credentials for the Arduino Create Session.
218
230
sketch Arduino CLI Sketch Commands.
219
231
upload Upload Arduino sketches.
220
- validate Validates Arduino installation.
221
232
version Shows version number of arduino CLI.
222
233
....
223
234
```
0 commit comments