Learn

Microcontroller lab experiments you can run with no kits

Intermediate

Or see every lesson.

  • 261parts on the bench
  • 31boards running now
  • 1.00xreal time, on every board
Traffic light on an Unolive0.000 s 0.00x
Press the button to cross
A pedestrian crossing on pins 8 to 11, with a request button on pin 2.

These microcontroller lab experiments run on an Arduino Uno in the browser. Your class does not need a single board or a USB cable. Students write real C++, it compiles in their own browser tab, and it runs on a simulated ATmega328P with the circuit around it.

The circuit above is the traffic light used in Lab 3. Press the button on the breadboard to ask to cross, and watch the lights change.

Each lab below has a starter you assign and checks that grade it. The first two are built-in lessons, which grade themselves step by step.

How to set up a lab

Make a class at /class and read out the six-letter join code. Students join at the same address. Then press Assign work, choose A template, and pick the template the lab names.

Under the assignment, press Checks and add the checks listed with the lab. Type the name exactly as shown, because the name is what a student reads when a check fails. Then press Save the checks.

Press Try it on the starter. On the untouched starter, the checks for the change should fail and the rest should pass. That shows the checks can tell a finished lab from an unfinished one.

One thing to know about checks: all the checks in one list run in one simulation. A press in one check is a press for every other check, so each press in these lists has its own moment.

Labs 1 and 2: Blink, and a button with serial output

Two built-in lessons make a good first week. In Assign work, choose A lesson. Pick "Blink: the first program (ours)", and then "Reading a button, and printing what it says (ours)".

A lesson walks the student through steps in the editor. The simulator checks the circuit at each checkpoint. When a student submits, their progress comes with it, so your list shows how many steps they passed.

Lab 3: Shorten the amber light

An Arduino Uno runs a pedestrian crossing. Red is pin 8, amber is pin 9, green is pin 10 and the walk lamp is pin 11. The button asks to cross.

Read the sketch. Find how long the amber light stays on.

Change it so amber lasts 1 second instead of 1.5 seconds. Keep everything else the same.

Run it, press the button, and time the lights. Then submit.

The starter is the template called Uno traffic light in Assign work. It is also the built-in project at /projects/traffic-light.

The answer is a one-line change, for your key: const unsigned long AMBER_MS = 1000;

Add these 4 checks under Checks:

Check 1: The sketch builds. The form writes it as: the sketch builds.

Check 2: Green stays on for the first 2.5 seconds. The form writes it as: after pb1 is pressed at 500 ms for 150 ms: pin 10 on uno1 reads HIGH at 2500 ms, by 2500 ms.

Check 3: Amber is on 3.5 seconds in. The form writes it as: after pb1 is pressed at 500 ms for 150 ms: pin 9 on uno1 reads HIGH at 3500 ms, by 3500 ms.

Check 4: Red is on 4.25 seconds in, after 1 second of amber. The form writes it as: after pb1 is pressed at 500 ms for 150 ms: pin 8 on uno1 reads HIGH at 4250 ms, by 4250 ms.

Lab 4: Make the false-start buzzer last one second

The reaction timer lights a lamp at a random moment and times your press. Press too early and the buzzer on pin 8 sounds for a short time.

Find the function that sounds the buzzer. Make the buzz last 1 second.

Run it and press the button before the lamp comes on. Then submit.

The starter is the template called Uno reaction timer in Assign work. It is also the built-in project at /projects/reaction-timer.

The answer is a one-line change, for your key: delay(1000); // inside growl(), in place of delay(400)

Add these 4 checks under Checks:

Check 1: The sketch builds. The form writes it as: the sketch builds.

Check 2: The sketch says hello. The form writes it as: the serial monitor prints a line matching /reaction timer/ within 1 s.

Check 3: After an early press, the buzzer is still on at 1.2 seconds. The form writes it as: after pb1 is pressed at 500 ms for 20 ms: pin 8 on uno1 reads HIGH at 1200 ms, by 1200 ms.

Check 4: The buzzer is off again at 2 seconds. The form writes it as: after pb1 is pressed at 500 ms for 20 ms: pin 8 on uno1 reads LOW at 2 s, by 2 s.

After the labs: debugging and registers

The editor has a debugger. Click beside a line to set a breakpoint, run, and read the registers and your own variables. The whole circuit stops with the board.

For an embedded systems course, the STM32 Blue Pill page shows how to drive a pin with registers instead of the Arduino calls. A serial monitor, a serial plotter and a logic analyzer help students see what the code does.

Questions

Which boards can students program?

The Arduino Uno, Nano, Mega and Leonardo, several ESP32 boards, the Raspberry Pi Pico, the STM32 Blue Pill and more. Each board page says what it runs and what it does not model.

How is a code change graded?

The student’s edited sketch is compiled in the browser before it is graded, with the same compiler the editor uses. If it does not compile, the run stops and the results say so.

Is a check the same as testing on a real board?

No. A check measures the simulation. Timing is ideal and there is no electrical noise. Test on real hardware before you rely on a design.

Can students work on the same circuit?

Yes. A live room puts several people on one circuit. How many fit depends on the owner’s plan: Pro and the Teacher plan have no limit on people.

Build this for real

Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.