START / INTRO LABS
Intro Glossary
The tools, circuits, and code used in Labs 1–5, explained at two levels.
Tools and files
- Arduino
The hardware and software ecosystem used to program boards such as the Uno.
Arduino names an ecosystem, not a programming language. The Intro Labs use the Arduino framework on an Uno, with code written in C++ and built through PlatformIO.
- Arduino Uno R3
The specific microcontroller board used in Intro Labs 1–5.
The Uno R3 contains an ATmega328P microcontroller, labeled input/output pins, a USB connection, and support circuitry. The lab pin names and 5 V assumptions refer to this board, not every Arduino-compatible device.
- Microcontroller
A small computer on a chip that reads inputs and controls outputs.
The Uno’s microcontroller runs the uploaded program without needing the laptop to execute each instruction. It can read a button on D2 and drive an LED on D8.
- VS Code
The editor where you open and change the lab’s C++ files.
VS Code is where you write and navigate the project. It does not by itself compile or upload the firmware; PlatformIO provides that workflow in these labs.
- PlatformIO
The toolchain that builds C++ code and uploads it to the Uno.
PlatformIO manages the selected board configuration, compilation, upload, and optional serial monitoring. Select the project environment for the Uno before building or uploading.
- C++ / .cpp
The programming language and file extension used by the lab programs.
The Intro Labs contain complete C++ programs in .cpp files, not Arduino .ino sketches. The Arduino framework supplies familiar functions such as pinMode() and digitalWrite() to that C++ code.
- Arduino framework
The software that provides setup(), loop(), and Arduino hardware functions.
With framework = arduino, the build includes Arduino’s startup behavior and APIs. Your code still uses normal C++ syntax and explicitly includes Arduino.h.
- src/main.cpp
The project file where the active C++ lab program belongs.
Replace the entire contents of src/main.cpp with one complete selected example. Do not paste a second setup() or loop() beneath an old program.
- platformio.ini
The project configuration identifying the board, framework, and monitor speed.
For these labs the provided file selects the Uno environment and Arduino framework and sets monitor_speed = 9600. This file configures the project; it is not where the LED program goes.
- Build
Compile the program and report whether it can become board firmware.
Build checks C++ and assembles a firmware image for the selected board. A successful Build does not send anything to the Uno or prove the physical circuit is correct.
- Upload
Transfer the built firmware into the Uno’s memory.
After Build succeeds, Upload sends the program over the selected USB/serial connection. The board then runs it; verify its real behavior separately.
- USB data cable
A USB cable that transfers programs as well as providing power.
Some USB cables only supply power. The Uno may light up with such a cable but still fail to appear as an upload port; use a verified data-capable cable.
- Serial Monitor
A computer window showing text a running program sends over serial.
PlatformIO Monitor displays output only if the uploaded program initializes Serial and prints data. In Lab 5, select “Read values in PlatformIO Monitor” to see the potentiometer readings; the first example does not print them.
Circuit and breadboard
- Pin
A labeled electrical connection on the Uno or another component.
A pin can send a signal, read a signal, supply a voltage, or connect to ground. Match labels like D8, A0, 5V, and GND to the correct type of connection.
- Digital and analog pins
Digital pins handle HIGH/LOW; analog inputs measure changing voltage.
D8, D9, and D10 are used as digital outputs in these labs. A0 measures the potentiometer voltage; Uno D9 also supports PWM output, which is not the same as an analog input.
- Breadboard
A reusable board for connecting components without soldering.
Hidden metal strips connect certain holes. A correct circuit depends on which holes are electrically joined, not just whether two parts look close together.
- Connected row / node
A group of breadboard holes already joined by metal underneath.
On a typical full-size breadboard, each five-hole terminal strip on one side of the center gap is connected. The gap separates the two sides; placing both LED legs in one connected strip shorts across the LED.
- Power rail
A long breadboard strip often used to distribute 5V or GND.
Side rails are not automatically powered or grounded; they work only when you wire them. Some rails are split in the middle, so verify continuity rather than assuming the whole length is connected.
- Jumper wire
A short wire used to join board pins and breadboard nodes.
A jumper must connect the intended electrical nodes. A wire plugged into a nearby but unconnected row will not complete the circuit.
- Closed circuit
A complete path that allows current to flow.
For the Lab 2 LED, trace D8 → resistor → LED → GND. If the path is open, the LED cannot light; a short or bypass can also defeat current limiting.
- GND / ground
The 0 V circuit reference and return connection on the Uno.
These labs need a complete return path to the Uno’s GND. “Ground” here is the circuit’s voltage reference; it does not mean the circuit must be connected to soil or an earth rod.
- 5V
The Uno’s nominal 5-volt supply connection.
Use it where a lab explicitly asks for a supply, such as across the potentiometer’s outer terminals. Never connect 5V directly to GND or place an unprotected LED across them.
- Voltage
The electric potential difference between two points.
The Uno reads a voltage at A0 and drives digital outputs at nominal LOW/HIGH levels. Voltage is measured between points; a pin alone does not have a meaningful voltage without a reference.
- Current
The rate at which electric charge flows.
An LED needs enough current to glow but can be damaged by too much. A resistor limits the current through an ordinary LED branch.
- Resistor
A component that limits current; these labs use 220–330 Ω per LED.
Put one verified 220–330 Ω resistor in series with each ordinary LED. Its exact position before or after the LED can vary, but it must not be bypassed.
- Series connection
Components connected along one path so the same branch current crosses both.
D8 → resistor → LED → GND is a series path. If both resistor legs sit in the same connected breadboard strip, the strip may bypass the resistor instead of limiting LED current.
- LED
A light-emitting diode that lights when forward biased and current limited.
Unlike a plain resistor, an LED has direction. The wrong orientation usually prevents it from lighting; an LED connected without suitable current limiting can be damaged.
- Anode and cathode
The LED’s positive-side and negative-side terminals in forward operation.
For a typical through-hole LED, the longer leg is usually the anode and the shorter leg or flat-sided package marks the cathode. If legs were trimmed, verify its identification rather than guessing.
Reading the code
- Arduino.h
The header that declares Arduino functions and constants to C++.
The lab files start with #include <Arduino.h>. That makes names like pinMode, digitalWrite, HIGH, and delay available to the compiler.
- setup()
The function that runs once after the Uno starts or resets.
Use setup() to configure hardware, such as setting D8 to OUTPUT or starting Serial. After setup() returns, the Arduino framework repeatedly calls loop().
- loop()
The function Arduino calls repeatedly while the program runs.
A blink program switches an output on, waits, switches it off, and waits inside loop(). At the end of the function, the same sequence begins again.
- Variable
A named place in a program for storing a value.
For example, const int ledPin = 8 names the pin used by the code. Changing that number does not physically move the jumper wire; software and wiring must agree.
- pinMode()
Tell the Uno whether a pin is an input or an output.
pinMode(8, OUTPUT) prepares D8 to drive the LED. pinMode(2, INPUT_PULLUP) configures a button input with an internal pull-up resistor.
- HIGH and LOW
The two named digital logic levels.
On the Uno, a digital output driven HIGH is normally near 5 V and LOW near 0 V. With INPUT_PULLUP, the unpressed button reads HIGH and the pressed button reads LOW.
- digitalWrite()
Set a digital output pin to HIGH or LOW.
digitalWrite(8, HIGH) drives the Lab 2 LED branch if wiring is correct. digitalWrite(8, LOW) switches it off.
- digitalRead()
Read the HIGH or LOW state at a digital input.
Lab 4 checks digitalRead(2). With its button wired from D2 to GND and INPUT_PULLUP enabled, pressed is LOW.
- delay()
Pause the program for a specified number of milliseconds.
delay(1000) waits about one second; delay(500) waits about half a second. This is a blocking wait, so loop() does not advance through the rest of its code during it.
- if / else
Run different instructions depending on a true-or-false condition.
Lab 4 uses if (digitalRead(buttonPin) == LOW) to turn the LED on while pressed, and else to turn it off otherwise. == compares values; = assigns a value.
- INPUT_PULLUP
An input mode with a built-in resistor holding the pin HIGH.
Wire the Lab 4 button between D2 and GND. The released input reads HIGH; pressing closes the path to GND and makes it LOW. Do not wire this button configuration to 5V.
- Serial.begin / Serial.print
Start serial communication and send readings to the computer.
Serial.begin(9600) sets the rate; Serial.print or Serial.println sends text or numbers. Opening PlatformIO Monitor does not create data if the active program never prints it.
Input and brightness
- Potentiometer
A three-terminal variable resistor used here as an adjustable voltage divider.
The two outer terminals connect to the Uno’s 5V and GND. Turning the shaft moves the center connection between those potentials, giving A0 a changing voltage.
- Wiper
The moving middle electrical contact of a potentiometer.
Connect the center wiper terminal to A0. Reversing the outer 5V and GND connections usually reverses which direction of knob rotation increases the reading.
- analogRead()
Convert the voltage at an analog input into a number.
On the Uno, analogRead(A0) normally returns 0–1023 for voltages across the default reference range. It measures voltage; it does not directly control LED brightness.
- ADC
The converter that turns an analog voltage into a digital reading.
The Uno uses a 10-bit analog-to-digital converter, giving 1024 possible codes: 0 through 1023. The code is a measurement of voltage relative to the reference, not a voltage in volts.
- PWM
Fast HIGH/LOW pulses whose duty cycle controls apparent LED brightness.
On the Uno, D9 can produce pulse-width modulation. Varying the proportion of time HIGH changes the LED’s perceived brightness; the pin is not outputting a steady analog voltage.
- analogWrite()
Set the PWM duty value on supported Uno pins, from 0 to 255.
Lab 5 uses analogWrite(9, brightness). A value of 0 is off, about 128 is roughly half duty cycle, and 255 is continuously HIGH; the perceived brightness is not necessarily linear.
- 9600 baud
The serial communication rate used by these lab examples.
The provided Uno platformio.ini already sets monitor_speed = 9600, matching Serial.begin(9600) in the relevant programs. Choose a serial-printing program before expecting numbers in PlatformIO Monitor.