Skip to content

Arduino β€” Microcontroller Programming Guide

Last reviewed: 2026-09-17

Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards can read inputs (light on a sensor, a finger on a button) and turn them into outputs (activating a motor, turning on an LED).


Overview

The Arduino ecosystem consists of: - Hardware boards β€” Uno, Nano, Mega, Due, Leonardo, etc. - Arduino IDE β€” cross-platform development environment - Arduino language (C/C++ with Arduino wrapper) β€” simplified syntax - Bootloader β€” allows programming via USB without external programmer

Arduino is the de facto entry point for embedded electronics, used by hobbyists, students, and professionals alike.


Topics Covered

  • Arduino fundamentals β€” boards, IDE, toolchain, and the sketch structure
  • Components and actuators β€” parts used in introductory projects: sensors, buttons, LEDs, motors, displays
  • Programming constructs β€” variables, control flow, functions, libraries, serial debugging
  • Analog and digital I/O β€” analogRead() / ADC, PWM output, interrupts, IΒ²C and SPI
  • ESP32-C3 wireless β€” the RISC-V-based MCU with Wi-Fi/BLE from Espressif, used from the Arduino toolchain
  • Game console design β€” designing a handheld console on Arduino-class hardware
  • Resistor colour codes β€” decoding 4-, 5- and 6-band markings

Key Arduino Concepts

Concept Description
Digital I/O Read/write HIGH/LOW (3.3V or 5V) on pins using digitalRead() / digitalWrite()
Analog I/O analogRead() reads 0–1023 (10-bit ADC); analogWrite() outputs PWM (0–255)
Serial Serial.print() / Serial.println() for debugging over USB
Libraries Pre-written code for sensors, displays, motors β€” #include <Library.h>
Interrupts attachInterrupt() for responding to pin changes instantly
IΒ²C / SPI Communicate with multiple peripherals over 2-wire (IΒ²C) or 4-wire (SPI)

Arduino Program Structure

void setup() {
  // Runs once at power-on
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // Runs repeatedly
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

Common Arduino Boards

Board MCU Flash SRAM Operating Voltage
Uno R3 ATmega328P 32 KB 2 KB 5V
Nano ATmega328P 32 KB 2 KB 5V
Mega 2560 ATmega2560 256 KB 8 KB 5V
Due SAM3X8E (ARM) 512 KB 96 KB 3.3V
ESP32 (3rd-party) Xtensa LX6 4 MB 520 KB 3.3V

Project Progression

  1. Blink β€” Hello World of hardware (LED on/off)
  2. Button input β€” Digital read with pull-up resistor
  3. Potentiometer β€” Analog input β†’ serial monitor
  4. Servo motor β€” PWM control
  5. Ultrasonic sensor β€” Distance measurement
  6. IΒ²C LCD β€” Display text output
  7. Temperature/humidity (DHT11) β€” Sensor reading
  8. Wireless (ESP8266/ESP32) β€” IoT sensor to web

Resources


To-do

Status: incomplete. Still to write:

  • Write the 'Components and actuators' section promised in Topics Covered (sensors, buttons, LEDs, motors, displays) β€” it is currently a single outline bullet.
  • Write the 'ESP32-C3 wireless' section promised in Topics Covered (Wi-Fi/BLE from the Arduino toolchain) β€” it appears only in the outline list.
  • Write the 'Game console design' section promised in Topics Covered β€” not written anywhere in the body.
  • Write the 'Resistor colour codes' section promised in Topics Covered (4-, 5- and 6-band decoding) β€” currently only a bullet naming the topic.