Digital ChallengeArduino × Processing
F1Foundation module

First Steps with Arduino

Make a microcontroller do something real — in under ten minutes.

Meet the Arduino Uno, learn how a breadboard works, upload your first program and wire an external LED. This is the foundation for every project in the Digital Challenge series.

2 × 45 min difficultyTechnologyPhysicsComputer Science
First Steps with Arduino
setup() & loop()digitalWrite()Breadboard wiringOhm’s law for LEDs
01Before you start

What you’ll learn

By the end of this module you can…
  • 1Identify the main parts of the Arduino Uno board (USB, digital pins, analog pins, GND, 5V, reset button, ATmega328P).
  • 2Explain how the rows and rails of a breadboard are connected inside.
  • 3Write, verify and upload a sketch using setup(), loop(), pinMode(), digitalWrite() and delay().
  • 4Wire an LED safely with a current-limiting resistor and calculate a suitable resistor value.
  • 5Follow a systematic workflow: schematic → simulation → real wiring → upload → test.
Key vocabulary
Microcontroller
A tiny computer on a single chip that reads inputs and controls outputs. On the Uno it is the ATmega328P.
Sketch
The name for an Arduino (or Processing) program.
Digital pin
A pin that is either HIGH (5 V) or LOW (0 V). The Uno has pins 0–13.
Analog pin
A pin (A0–A5) that can measure a voltage between 0 and 5 V as a number 0–1023.
GND (ground)
The 0 V reference point. Every circuit needs a path back to GND.
Anode / Cathode
The + (longer leg) and − (shorter leg, flat side) of an LED.
Resistor
A component that limits current. Measured in ohms (Ω).
Breadboard
A reusable board for building circuits without soldering.
02Kit list

Required equipment

ComponentQtyPurpose
Arduino Uno1Main development board
USB cable1Connection to computer and program upload
Breadboard1Quick connection without soldering
LED diode1–3Visual indicator of program execution
220 Ω resistor1–3Current limiting for the LED
Push button1Input for the advanced tasks
Jumper wires~6Connecting components
Arduino IDE1Writing and uploading programs
Tinkercad or Circuit Designer1Circuit simulation and verification
03Theory

What is Arduino?

Arduino is a hardware and software platform built around a microcontroller. A small board can read signals from sensors, process them, and then control LEDs, motors, relays, displays or other devices.

Thanks to simple wiring, a huge number of examples and extensive library support, Arduino is ideal for beginners as well as for rapid prototyping in school and project work.

Mental model
Think of Arduino as the brain of your project: it reads inputs (sensors, buttons) and controls outputs (LEDs, motors, displays).
01
Input
sensor / button
02
Process
your sketch
03
Output
LED / motor / screen

Why the Arduino Uno?

The Uno is the most common first board: stable, well documented and easy to use. It has enough input/output pins for school experiments without unnecessary complexity. Once you know the Uno, moving to a Nano, Mega or ESP32 is easy.

04Hardware

Anatomy of the Uno

Main parts of the Arduino Uno board (original handbook figure).
Main parts of the Arduino Uno board (original handbook figure).
PartWhat it does
USB connectorConnects to the computer — power + program upload
Digital pins 0–13Digital input and output (HIGH / LOW)
Analog pins A0–A5Read analog sensor values (0–1023)
GNDGround — the negative reference
5V and 3.3VPower supply pins for components
Built-in LEDConnected to pin 13 — perfect for the first test
Reset buttonRestarts your program from the beginning
ATmega328PThe microcontroller chip — the processor of the board
Tip
Always identify GND and the power pins before connecting any component.
05Electronics

Breadboard, Resistors & LEDs

A basic electronics starter kit: board, breadboard, wires, resistors, LEDs, buttons and sensors.
A basic electronics starter kit: board, breadboard, wires, resistors, LEDs, buttons and sensors.

A breadboard lets you connect components without soldering, so you can change connections, test ideas and re-verify circuits quickly. Inside, each short row of 5 holes is connected; the long rails along the edges are usually used for 5V and GND.

A resistor limits current. An LED has almost no resistance of its own, so without a resistor it would draw too much current and burn out — or damage the Arduino pin.

LED polarity
The anode (longer leg) connects to the signal pin through the resistor. The cathode (shorter leg, flat side of the rim) connects to GND.

How big should the resistor be?

Use Ohm’s law. The resistor “uses up” the voltage the LED doesn’t need. With a 5 V pin, a red LED that drops about 2 V, and a safe current of about 15 mA:

Formula
R = (V_supply − V_LED) / I = (5 V − 2 V) / 0.015 A = 200 Ω
Choose the next standard value up: 220 Ω.
InteractiveLED resistor calculatorTry it: pick an LED colour and current to see the resistor you need.
LED colour (forward voltage)
R = (5 V − 2.0 V) / 0.015 A = 200 Ω
next standard (E12) ≥ ideal → 220 Ω
Resistor
220 Ω
Actual current
13.6mA
Resistor power
41mW

Always round up to the next available value — a slightly larger resistor means slightly less current, which is safe.

Safety first
Unplug the USB cable before changing wiring. Never connect 5V directly to GND (a short circuit). If anything gets hot or smells, disconnect immediately and tell your teacher.
06Tools

Arduino IDE, Tinkercad & Circuit Designer

Programs for Arduino are usually written in the Arduino IDE: this is where code is written, checked for errors and uploaded to the board. Tinkercad and Circuit Designer let you plan and simulate a circuit before building it for real.

  • ▸writing and editing programs (sketches),
  • ▸uploading programs to the Arduino board,
  • ▸monitoring program execution via the Serial Monitor,
  • ▸adding libraries for sensors and other components.

The IDE is free on the official Arduino website. After installing, select the correct board type and COM port, then upload.

Best practice
Simulate the circuit in Tinkercad first, then build it physically on the breadboard.

Sensors & actuators you will meet later

Sensor / ActuatorTypeUsed in
DHT11Temperature & humidity sensorProject 1
LDR (photoresistor)Light sensorProject 2
HC-SR04Ultrasonic distance sensorProject 3
SG90 servo motorPosition actuatorProject 3
Relay moduleElectrical switch (actuator)Project 5
Soil moisture sensorCapacitive sensorProject 5
08Hands-on

Lab 2 — An External LED on a Breadboard

Now move from the built-in LED to an external one and build a real circuit for the first time. Notice how the schematic, the physical wiring and the program connect.

Physical breadboard wiring: pin 8 → 220 Ω → LED → GND.
Physical breadboard wiring: pin 8 → 220 Ω → LED → GND.
Arduino UnoComponentConnection
Pin 8LED anode (+)Through a 220 Ω resistor
GNDLED cathode (−)Directly to ground
ExternalLED.inoArduino · C++
const int ledPin = 8;

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  delay(500);
  digitalWrite(ledPin, LOW);
  delay(500);
}

The program turns the LED on pin 8 on, waits half a second (500 ms), turns it off, waits again — and repeats forever.

A systematic approach
Schematic → Simulation (Tinkercad) → Real wiring → Upload code → Test. If it doesn’t work, check the physical connections first, then the code.
09From the original handbook

Student tasks

Basic
Change the delay value
Understand the effect of pause duration
Intermediate
Move the LED to a different pin
Practise pin assignment in code
Advanced
Add a push button to control the LED
Learn INPUT_PULLUP and digitalRead
Challenge
Create a 3-LED sequential light effect
Multiple outputs, timing logic
10When it doesn’t work

Troubleshooting

ProblemLikely causeFix
Upload fails / “port not found”Wrong COM port or board selectedTools → Port: pick the port that appears when you plug the board in.
LED never lightsLED inserted backwardsTurn the LED around: long leg towards the resistor/pin.
LED lights but is very dimResistor too large (e.g. 10 kΩ)Check the colour bands: 220 Ω is red-red-brown.
Nothing changes after editingCode verified but not uploadedClick Upload, not only Verify.
Golden rule
Check the physical connections first, then the code. If nothing works, unplug, close both programs, reconnect and try again.
11New in this edition

Exercises

Basic · 2Intermediate · 2Advanced · 1Challenge · 1
F1.1BasicPredict 5 min

Predict the rhythm

Without running it, describe exactly what the LED does with this loop(). How many times does it flash per minute?

starterArduino · C++
void loop() {
  digitalWrite(8, HIGH);
  delay(200);
  digitalWrite(8, LOW);
  delay(800);
}
Add the two delays to get the length of one full cycle.
The LED flashes briefly (on for 0.2 s, off for 0.8 s). One cycle lasts 200 + 800 = 1000 ms = 1 s, so it flashes 60 times per minute. The duty cycle (time on ÷ total time) is 20 %.
F1.2BasicCalculate 10 min

Choose the resistor

A blue LED needs about 3.0 V and should run at 10 mA. The Arduino pin gives 5 V. Calculate the ideal resistor, then choose a real value from this list: 100 Ω, 150 Ω, 220 Ω, 330 Ω, 1 kΩ.

R = (V_supply − V_LED) / I. Remember 10 mA = 0.010 A. Always round up to the next available value.
R = (5.0 − 3.0) / 0.010 = 200 Ω. The closest standard value that is not smaller is 220 Ω — the current will then be (2.0 / 220) ≈ 9.1 mA, which is safe.
F1.3IntermediateCode 15 min

SOS beacon

Program the external LED to blink SOS in Morse code: three short (200 ms), three long (600 ms), three short — then a 2-second pause. Use a helper function so you don’t repeat yourself.

Write void flash(int ms) that turns the LED on for ms, then off for 200 ms. Call it inside for loops.
SOS.inoArduino · C++
const int ledPin = 8;

void flash(int ms) {
  digitalWrite(ledPin, HIGH);
  delay(ms);
  digitalWrite(ledPin, LOW);
  delay(200);
}

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
  for (int i = 0; i < 3; i++) flash(200);  // S
  for (int i = 0; i < 3; i++) flash(600);  // O
  for (int i = 0; i < 3; i++) flash(200);  // S
  delay(2000);
}
F1.4IntermediateDebug 10 min

Find three bugs

This sketch should blink an LED on pin 8 but it does not even compile — and even when it compiles, the LED stays dark. Find all three problems.

starterArduino · C++
const int ledPin = 8

void setup() {
  pinMode(ledPin, INPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  delay(500);
  digitalWrite(ledpin, LOW);
  delay(500);
}
Look for a missing character, a wrong mode, and a spelling difference (C++ is case-sensitive).
1) Missing semicolon after const int ledPin = 8. 2) pinMode must be OUTPUT, not INPUT. 3) ledpin ≠ ledPin — names are case-sensitive.
F1.5AdvancedBuild 20 min

Push-button lamp

Add a push button between pin 2 and GND. The LED on pin 8 should be ON only while the button is held down. Use the internal pull-up resistor.

  1. 01Place the button across the middle gap of the breadboard.
  2. 02Connect one side to pin 2 and the other side to GND.
  3. 03In setup() use pinMode(2, INPUT_PULLUP);.
  4. 04Remember: with a pull-up, the pin reads LOW when pressed.
ButtonLamp.inoArduino · C++
const int ledPin = 8;
const int buttonPin = 2;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);
}

void loop() {
  bool pressed = digitalRead(buttonPin) == LOW;
  digitalWrite(ledPin, pressed ? HIGH : LOW);
}
F1.6ChallengeDesign 30 min

Traffic light controller

Build a traffic light with red (pin 10), yellow (pin 9) and green (pin 8) LEDs, each with its own 220 Ω resistor. Sequence: green 4 s → yellow 1 s → red 4 s → red + yellow 1 s → repeat. Extension: add a pedestrian button that shortens the green phase.

Write a helper void lights(bool r, bool y, bool g, int ms) that sets all three LEDs and then waits.
TrafficLight.inoArduino · C++
const int RED = 10, YELLOW = 9, GREEN = 8;

void lights(bool r, bool y, bool g, int ms) {
  digitalWrite(RED, r);
  digitalWrite(YELLOW, y);
  digitalWrite(GREEN, g);
  delay(ms);
}

void setup() {
  pinMode(RED, OUTPUT);
  pinMode(YELLOW, OUTPUT);
  pinMode(GREEN, OUTPUT);
}

void loop() {
  lights(0, 0, 1, 4000);  // green
  lights(0, 1, 0, 1000);  // yellow
  lights(1, 0, 0, 4000);  // red
  lights(1, 1, 0, 1000);  // red + yellow
}
12Check yourself

Self-check quiz

Progress
0/5 answered · 0 correct
  1. Q01

    Which function runs only once when the Arduino starts?

  2. Q02

    Which leg of an LED connects to GND?

  3. Q03

    What does delay(250) do?

  4. Q04

    Why do we always put a resistor in series with an LED?

  5. Q05

    Which pin is connected to the built-in LED on an Arduino Uno?

13Beyond the classroom

Real world & extensions

Where this is used
educational workshops and STEM activitiessmart home prototype developmentfirst IoT projects and connected devicesmeteorological and measurement systemsrobotic and automated solutionsinteractive art and light installationswearable electronics and maker projects
Extension ideas
  • +Serial Monitor messages — Serial.begin(), Serial.println() (basic)
  • +Push-button toggle — digitalRead, INPUT_PULLUP, state logic (intermediate)
  • +LDR light control — analogRead, map(), calibration (intermediate)
  • +Servo motor control — Servo library, PWM signals (advanced)
  • +Traffic-light system with 3 LEDs and a timed sequence (intermediate)
  • +ESP32 WiFi LED control — web server, IoT concepts (challenge)
Cross-curricular connections
SubjectConnection
PhysicsVoltage, current, resistance and Ohm’s law
Computer ScienceSequence, loops, constants and functions
TechnologyPrototyping, testing and debugging workflow
14Think about it

Reflection & conclusion

?1

Where in your home or school is there a device that probably contains a microcontroller? What are its inputs and outputs?

?2

Why is it smart to simulate a circuit before building it?

?3

What was the hardest part of today — the wiring or the code? Why?

Conclusion

You took the first step with the Arduino platform. Through Blink and the external LED you saw how a program, electronic components and a physical circuit come together as one system. Reading a schematic, writing setup() and loop(), using digitalWrite() and delay() and wiring a breadboard are skills you will use in every following project — from temperature sensors to sonar and automatic irrigation.