Sub topic 1
What an Arduino board is and what the IDE does for it
Prerequisites
This chapter assumes you can install software on Windows, macOS, or Linux, and that you have a supported board such as an Arduino Uno with a USB data cable. A data cable carries information as well as power. You should also understand that a program is a list of instructions that a computer runs in order.
What an Arduino board is
An Arduino board is a small circuit board built around a microcontroller. A microcontroller is a single chip that runs one program and reads inputs, such as buttons and sensors, while controlling outputs, such as LEDs and motors. The board keeps your program in flash memory, so the program survives when the power is removed.
The board does not write or compile code. The Arduino IDE (integrated development environment) runs on your computer and does that work. It compiles a sketch, the name Arduino uses for a program, into machine code the chip can run. It then uploads that code to the board over USB.
Installing the Arduino IDE
Download the Arduino IDE 2.x from arduino.cc/en/software. Run the installer and keep the default options. On Linux, add your user to the dialout group so the IDE can open the serial port.
A tour of the IDE interface
- Toolbar: Verify compiles the sketch. Upload compiles it and sends it to the board.
- Board and Port selectors: Choose the board model and the USB port it is connected to.
- Editor: Where you write the sketch.
- Output pane: Shows compile results and error messages.
- Serial Monitor: Displays text the board sends back. Open it from the magnifying-glass icon.
Connecting your board over USB
Plug the board into your computer with the data cable. The board's power LED should light. Open the Port menu in the IDE. The board appears with a port name such as COM3 on Windows, /dev/cu.usbmodem... on macOS, or /dev/ttyACM0 on Linux.
Exercise
Verify works even when the board is unplugged, but Upload does not. Why?
Show answer
Verify only compiles the sketch on your computer. Upload sends the compiled code to the board through the selected port, so it needs the board connected.