Sub topic 1
What an Arduino Board Is and What the IDE Does for It
An Arduino board is a small development board built around a microcontroller. A microcontroller is a programmable computer on a single chip. It reads electrical signals, makes decisions, and controls outputs such as LEDs, motors, and displays.
The board adds useful hardware around the microcontroller:
- Digital pins read or output two-state signals, such as
HIGHandLOW. - Analog input pins measure changing voltages.
- Power pins provide voltage and ground connections.
- USB hardware connects the board to a computer.
- A bootloader helps receive a new program over USB.
This chapter assumes that you know how to install software, connect a board with a USB data cable, and understand that a program is a list of instructions.
The board and the computer have different jobs
Your computer runs the Arduino Integrated Development Environment, or Arduino IDE. An IDE is an application that combines a code editor with tools for building and transferring programs.
The Arduino board runs the program after it has been uploaded. It does not normally run the C++ source text directly. The IDE and its toolchain translate the source into machine code that the microcontroller understands.
| Part | Main responsibility |
|---|---|
| Arduino board | Runs the uploaded machine code and interacts with electronics |
| Arduino IDE | Lets you write, verify, compile, and upload a sketch |
| USB cable | Carries power and data between the computer and board |
| Bootloader | Receives a new program and stores it on the board |
The IDE calls an Arduino program a sketch. A sketch is usually written in a simplified form of C++. The IDE adds some Arduino-specific support and then invokes a compiler. A compiler translates human-readable source code into machine code.
What happens when you upload
Uploading is a sequence of separate operations:
- The IDE checks the sketch for syntax and other build errors.
- The compiler converts the sketch into machine code.
- The IDE packages the result in a format the board can receive.
- The board's bootloader listens briefly for an upload.
- The IDE sends the program through the selected USB serial connection.
- The bootloader writes the program into the microcontroller's flash memory.
- The board resets and starts the new program.
Flash memory keeps its contents when power is removed. That is why a board can continue running an uploaded sketch after you unplug and reconnect it.
The board is more than a processor
An Uno-class board commonly uses an ATmega328P microcontroller. Other Arduino boards use different microcontrollers with different memory sizes, processor speeds, voltage levels, and pin layouts.
These differences matter. A sketch written for one board may compile for another but use the wrong pin number or hardware feature. The IDE therefore needs to know the target board. The selected board setting tells the compiler which processor rules, memory layout, and upload method to use.
A board package supplies this information and the tools needed to build for a board family. The Arduino IDE includes support for many official boards. Other boards require their vendor's package.
The USB connection can also appear as a serial port. The selected port identifies which connected device should receive the upload. A correct board selection with an incorrect port still sends the program to the wrong destination or produces an upload error.
A minimal sketch
This complete sketch makes the built-in LED blink. It demonstrates the kind of source code that the IDE compiles and sends to the board.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}The IDE does not make the board intelligent by itself. It provides the workflow that turns this source into a program the board can store and execute. The board supplies the processor, memory, pins, and electrical interfaces that make the program useful in the physical world.
Exercise
Why can the IDE compile a sketch successfully but still fail to upload it?
Show answer
Compilation only checks and builds the program on the computer. Uploading also requires the correct board, the correct serial port, a working USB data connection, and a responding bootloader.