Arduino Learning Studio full lab
0/13 lessons marked complete
● Saved in this browser← Back to homepage

Lesson 1 of 13

Meet the board

Objective: Name the main parts of the board, then use the Serial Monitor to see setup() run once, loop() repeat and a variable keep count.

MODEL OF THIS SKETCHSTOPPED
USBRESET16U2LTXRXON1312~11~10~987~6~54~3210DIGITAL (PWM ~) · 1 = TX, 0 = RXATmega328P3.3V5VGNDGNDVinA0A1A2A3A4A5

▶ Run starts the model as if the sketch had just been uploaded and the Serial Monitor opened. It does not compile C++.

Serial Monitor · modelsketch stopped

Press ▶ Run. The monitor shows only what the sketch prints.

Line ending: New Line

Timestamps: simulated time since the sketch started.

Stage 1 of 7 · What am I building?

Explore

The board is a small computer. Select each part on the board, or below. Start with the three a message passes through on its way to your computer: the microcontroller, the USB-to-serial chip and the USB connector. Then press ▶ Run and watch the TX light.

Pick a part. 0/11 inspected.

New ideas in this lesson

Microcontrollers

A small computer on one chip that stores a program and runs it forever, reading and controlling its pins.

Pins, inputs and outputs

Each pin is configured as an input (the program reads it) or an output (the program drives it). pinMode() chooses.

setup() and loop()

setup() runs once after power-up or reset. loop() then runs again and again, as fast as its statements allow.

Variables and constants

A variable is a named value that can change; `const` makes a name for a value that never changes. Declared outside every function (global), a variable keeps its value between passes of loop(); declared inside loop(), it starts again on every pass.

Serial communication and debugging

Serial.begin(baud) starts serial communication, which reaches the computer over USB; Serial.print() and println() send text, which the Serial Monitor shows when it is set to the same baud. Only what the sketch prints appears: pin activity never shows up by itself.

Simulation vs real hardware

The lab models ideal parts. Real circuits add tolerances, noise, loose wires and power limits, so always check wiring before powering up.

Build it for real · Arduino Uno R3

You need

  • Arduino Uno R3 (or compatible) and its USB cable
  • A computer with the Arduino IDE (or Arduino Cloud Editor)

Wiring

  1. Plug the board into the computer with the USB cable.
  2. In the IDE, pick Arduino Uno and its port in the board selector (or Tools → Board → Arduino AVR Boards → Arduino Uno, then Tools → Port).
  3. Upload the sketch. The upload should finish without errors.
  4. Open the Serial Monitor (the magnifying-glass button, or Tools → Serial Monitor) and set it to 9600 baud.
  5. Watch the TX light flash each time the sketch prints. Press RESET: setup() runs again and the count starts from 1.

Before you power up: Keep the board off metal surfaces and loose wires: anything conductive touching the underside can short its pins.

Tip: Opening the Serial Monitor often restarts an Uno, so you see the greeting again. Keep D0 and D1 free: they carry the USB serial link.

The lab models ideal parts. Real circuits add tolerances, noise and loose wires, so check your wiring against this list before you plug in.

Sketch · read-only
// Meet the board: send messages to the computer over USB
// Open the Serial Monitor at 9600 baud to read them
const int pauseMs = 1000;         // a constant: this value never changes
int count = 0;                    // a variable: it changes as the sketch runs

void setup() {
  Serial.begin(9600);             // start serial at 9600 baud (to the computer)
  Serial.println("Hello from setup"); // runs once
}

void loop() {
  count = count + 1;              // add 1 on every pass
  Serial.print("loop number ");
  Serial.println(count);          // print the count, then end the line
  delay(pauseMs);                 // wait, then loop() starts again
}

Press ▶ Run and watch the Serial Monitor and the TX light.