Sub topic 2
Installing board packages with the Boards Manager
This chapter assumes you have the Arduino IDE installed, a board and a USB data cable, and a basic idea of what a sketch is.
The IDE includes support for classic AVR boards such as the Uno. Newer or third-party boards, such as the Nano 33 BLE or an ESP32, need a board package, also called a core. A board package holds the compiler settings, bootloader files, and pin definitions for one microcontroller family. The Boards Manager downloads and installs these packages.
Installing a board package
- Open Tools > Board > Boards Manager.
- Search for your board family, for example "Arduino Mbed OS Nano Boards".
- Click Install on the entry published by Arduino, and wait for the progress indicator to finish.
Selecting your board
Open Tools > Board and choose the exact model printed on your board. A wrong choice can produce upload errors or pin numbers that do not match your wiring.
Selecting the serial port
Plug the board in by USB, then open Tools > Port. On Windows, the port looks like COM3. On Linux or macOS, it looks like /dev/ttyACM0 or /dev/cu.usbmodem.... To identify the right entry, unplug the board and see which entry disappears.
How a sketch is structured
Every sketch defines two functions:
void setup() {
// Runs once after power-up or reset.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// Runs repeatedly until power is removed or the board resets.
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}Exercise
Why does an Uno usually work without installing a board package?
Show answer
The IDE bundles the AVR core that the Uno uses, so no extra package is needed.
Exercise
How often does the code inside loop() run after setup() finishes?
Show answer
It runs repeatedly, one pass after another, until the board loses power or resets.