An Hour of Code with hardware swaps the on-screen puzzle for a real circuit. In 60 minutes, your students switch a light on from a screen, dim it, flash an SOS, then build an if-then rule that turns the light on by itself when the room goes dark. They meet the same ideas as a screen tutorial: sequences, conditions, testing and debugging. The difference is that the result glows on the desk in front of them.
The plan works with MakerBuddy kits, one kit for every two or three students. It also works with no kit at all, using the free "Try it" demos on the lesson pages. Below are the minute-by-minute plan, the setup, every step with the real button names, links to the CSTA standards and the mistakes that eat the hour.
What the Hour of Code is in 2026, and where hardware fits
The Hour of Code began in 2013 as a one-hour introduction to computer science during Computer Science Education Week (CS Education Week, or CSEdWeek). That first year it reached over 15 million students in 167 countries, according to the CSEdWeek about page (opens in a new tab). The same page says the Computer Science Teachers Association (CSTA) has coordinated the week since 2020, while Code.org runs the hour.
Two things have changed since then.
- The name. In October 2025, Code.org and CSforALL announced the Hour of AI, as THE Journal reported (opens in a new tab). Code.org's Hour of AI page (opens in a new tab) now says the Hour of Code is the Hour of AI, and hourofcode.com now forwards to hourofai.org. The older coding tutorials are still listed under Hour of Code Activities on the activities page (opens in a new tab).
- The dates. CS Education Week is held in the week of Grace Hopper's birthday, 9 December, as the CSEdWeek about page (opens in a new tab) explains. For 2026, the Hour of AI how-to guide (opens in a new tab) names 7 to 11 December as the main week. It also says an hour works any time of year, on any device or none.
So an Hour of Code activity can be a screen tutorial, an unplugged game, or a physical computing hour like this one. In a hardware hour, students still build a program, but the program moves something real. This plan is not an official Hour of AI activity. It is a lesson you run yourself, in CS Education Week or any other week, in any country.
The 60-minute plan, minute by minute
Students work in pairs or threes, each group with a kit and a device, or a device with the lesson page open. The hour uses two parts built into the board, the blue light and the light sensor, so nobody plugs anything in.
| Minutes | Segment | What you do | What students do | Where |
|---|---|---|---|---|
| 0–5 | Hook | Ask how a phone screen knows to dim itself in a dark room | Name devices that sense something and react | Discussion |
| 5–10 | Get connected | Put the dashboard on the class screen; check every group is in | Open the dashboard, or the Try it demo on Lesson 4 | Kit or demo |
| 10–20 | Hello World | Show the LED On/Off switch once | Switch the blue light on and off; dim it to PWM 26, 128 and 255 | Lesson 4 |
| 20–25 | SOS challenge | Time one pair | Flash SOS: short dots, long dashes | Lesson 4 |
| 25–30 | Unplugged rule | Run the human nightlight game | Act out "if the light level is below 50, turn the light on" | Paper |
| 30–42 | Build the rule | Show the Rule Engine tab once | Measure bright and dark; build and test the Nightlight rule | Lesson 26 |
| 42–50 | Debug | Ask why the light stays on | Add a Morning rule; test dark, middle and bright | Lesson 27 |
| 50–55 | Guess the loop mode | Read out five devices | Pick No Loop, Forever, Timer or Condition for each | Lesson 21 |
| 55–60 | Reflect | Collect the exit ticket | Say what their system senses, decides and does | Discussion |
- Minutes
- 0–5
- Segment
- Hook
- What you do
- Ask how a phone screen knows to dim itself in a dark room
- What students do
- Name devices that sense something and react
- Where
- Discussion
- Minutes
- 5–10
- Segment
- Get connected
- What you do
- Put the dashboard on the class screen; check every group is in
- What students do
- Open the dashboard, or the Try it demo on Lesson 4
- Where
- Kit or demo
- Minutes
- 10–20
- Segment
- Hello World
- What you do
- Show the LED On/Off switch once
- What students do
- Switch the blue light on and off; dim it to PWM 26, 128 and 255
- Where
- Lesson 4
- Minutes
- 20–25
- Segment
- SOS challenge
- What you do
- Time one pair
- What students do
- Flash SOS: short dots, long dashes
- Where
- Lesson 4
- Minutes
- 25–30
- Segment
- Unplugged rule
- What you do
- Run the human nightlight game
- What students do
- Act out "if the light level is below 50, turn the light on"
- Where
- Paper
- Minutes
- 30–42
- Segment
- Build the rule
- What you do
- Show the Rule Engine tab once
- What students do
- Measure bright and dark; build and test the Nightlight rule
- Where
- Lesson 26
- Minutes
- 42–50
- Segment
- Debug
- What you do
- Ask why the light stays on
- What students do
- Add a Morning rule; test dark, middle and bright
- Where
- Lesson 27
- Minutes
- 50–55
- Segment
- Guess the loop mode
- What you do
- Read out five devices
- What students do
- Pick No Loop, Forever, Timer or Condition for each
- Where
- Lesson 21
- Minutes
- 55–60
- Segment
- Reflect
- What you do
- Collect the exit ticket
- What students do
- Say what their system senses, decides and does
- Where
- Discussion
Students first control an output by hand, as in Lesson 4, Hello World and PWM Dimming, then hand that control to a rule, the idea behind Lesson 21, The Rule Engine and the 4 Loop Modes.

Before the hour: kits, devices and Wi-Fi
Setup problems can eat the whole hour, so sort these out a day or two before.
What each group needs
- A MakerBuddy board and its micro-USB cable, powered from a laptop or a USB charger. The board runs on 5 V.
- Chrome, Edge or Firefox with the free MakerBuddy extension, or Safari on a Mac, iPhone or iPad. Or the free MakerBuddy app from Google Play on an Android phone or tablet.
- A 2.4 GHz Wi-Fi network that asks only for a name and a password. A phone hotspot set to 2.4 GHz works.
- With no kit: just a browser. The Try it demos need no extension, no board and no account.
How many kits for a class of 28
The teacher guide plans one kit for every two or three students.
| Plan | Sum | Kits | Devices |
|---|---|---|---|
| Threes | 28 ÷ 3 = 9.3, rounded up | 10, plus 1 spare | 10 |
| Pairs | 28 ÷ 2 = 14 | 14, plus 1 spare | 14 |
| Rotation | 14 students ÷ 3 = 4.7, rounded up | 5, plus 1 spare | 5 for kits, 7 for the demo |
- Plan
- Threes
- Sum
- 28 ÷ 3 = 9.3, rounded up
- Kits
- 10, plus 1 spare
- Devices
- 10
- Plan
- Pairs
- Sum
- 28 ÷ 2 = 14
- Kits
- 14, plus 1 spare
- Devices
- 14
- Plan
- Rotation
- Sum
- 14 students ÷ 3 = 4.7, rounded up
- Kits
- 5, plus 1 spare
- Devices
- 5 for kits, 7 for the demo
Kits are not used up, so one set serves every class that week. In Pakistan, kits are ordered online at PKR 40,000 each, with 2% off from 10 kits, so 10 kits come to PKR 392,000. Schools in the USA, Canada and elsewhere get a written quote. Both start on the MakerBuddy order page.
Set up the day before
- 1
Set up each board once and give it its own name, such as makerbuddy-01. Lesson 3, Powering Up and Connectivity shows how.
- 2
Ask IT to allow the MakerBuddy extension on school laptops.
- 3
Put the boards and student devices on the same network. Guest networks often stop devices from seeing each other.
- 4
Delete any rules a previous class left on the boards.
- 5
Try each Try it demo once on Lessons 4, 21, 26 and 27.
The board's local connection has no password, so use a network you trust and never make the board reachable from the internet. The technical details page explains what that means on a school network.
Part 1 (minutes 5 to 25): Hello World with a real light
A first program usually prints "Hello World". In electronics, the first program switches on a light.
With a kit
- 1
Find the blue light next to the label 12-LED. It is already wired.
- 2
On the dashboard, find the LED Control card, with its LED On/Off switch and Brightness (PWM) slider.
- 3
Click the switch. The light comes on almost at once. Click again: it goes off. Click quickly a few times: the board keeps up.
- 4
Switch it on again and slide Brightness (PWM) to about 26, then 128, then 255. The slider only moves while the light is on.
With no kit
Open Lesson 4, find "Try It: Dim the LED", press Start the demo and choose "I don't have the kit yet". It shows a drawing of the board, the same LED Control card and a slowed-down picture of the signal. It ticks off each target as students reach it.
What is going on: PWM
A light cannot be "half on". So the board switches it on and off very fast, about a thousand times a second as Lesson 4 explains, and your eye sees the average. This is pulse width modulation, or PWM. Espressif's Arduino-ESP32 LEDC documentation (opens in a new tab) gives the range: 0 is always off and 255 is always on. So 128 is on about half the time (50%) and 26 about a tenth (10%). Our coming guide to PWM explained with an LED goes deeper.

The SOS challenge (minutes 20 to 25)
SOS in Morse code is three short flashes, three long, three short. Lesson 4 sets the timing: about half a second for a dot, about a second and a half for a dash, and about a second between letters. A partner who cannot see the screen must read SOS from the light alone.
This is the first real program of the hour: steps in order, with timing. In the demo, students hold a Flash key, and the demo checks their timing.
Part 2 (minutes 25 to 42): Build a rule that runs by itself
So far the student is the brain. Part 2 hands that job to the board.
The human nightlight (minutes 25 to 30)
Act the rule out before anyone touches a screen. Three students stand at the front.
- The sensor holds up a number from 0 to 100. High means bright, low means dark.
- The board holds the rule card: "IF the light level is below 50, THEN turn the light on."
- The light stands up when told "on".
Call out 80, 65, 30, 52 and 49, and let the board decide each time. Then ask: "The number goes back to 80. What does the light do?" The card never says when to sit down. Leave that question open until Part 3. Lesson 20, Algorithmic Thinking turns this game into flowcharts on another day.
Measure first (minutes 30 to 33)
A rule needs a number, and the right number depends on the room. Read the Light Level card and write it down. Cover the sensor with a hand, wait a few seconds and read it again. Lesson 26 gives about 80 bright and 20 covered as an example. Pick a number halfway between your two readings, such as 50. Our guide to how an LDR light sensor works explains why the number falls when you cover it.
The Nightlight rule, step by step (minutes 33 to 42)
This is the worked example from Lesson 26, Sensor-Based Control, with the dashboard's real labels.
- 1
Open the Rule Engine tab. In Create Rule, type Nightlight as the Rule Name.
- 2
Set Loop Mode to Condition.
- 3
Under Loop Condition, set Sensor to Light Level (LDR), Operator to Less than (<) and Threshold to 50, or your own halfway number.
- 4
Click Add Step. Set Action to LED On, Value to 255 and Delay (ms) to 100.
- 5
Click Save Rule. The rule list shows Nightlight as Monitoring: it is watching the light.
- 6
Cover the sensor. Within about a second, the blue light comes on by itself.
Why about a second? The board reads its sensors once a second, and a condition must stay true for 0.3 seconds before the rule starts, as the technical details page explains under how rules run. The rule runs on the board itself, not in the browser.
With no kit, use "Try It: Build a Condition Rule" on Lesson 26. It has the same Create Rule form, and a "✋ Cover with hand" button stands in for a real hand.
Print one task card per group. It keeps everyone on the same steps and gives you something to collect.
HOUR OF CODE WITH HARDWARE: TASK CARD Names: ______________
PART 1 Hello World
[ ] Blue light on, then off
[ ] Dim it: PWM 26 ... PWM 128 ... PWM 255
[ ] SOS: dot about 0.5 s, dash about 1.5 s. Partner read it? yes / no
PART 2 A rule that runs by itself
Room reading: ______ Covered reading: ______
My halfway number: ______
Rule: IF Light Level < ______ THEN LED On, Value 255
[ ] Covered the sensor: the light came on by itself
PART 3 Fix and sort
Uncovered: what did the light do? ____________________
Fix: IF Light Level > ______ THEN LED Off
Loop mode for: siren ____ water reminder ____ streetlight ____
"system online" light ____ greenhouse pump ____
Our system senses ________, decides ________, and does ________.
Part 3 (minutes 42 to 60): Fix the bug, guess the loop mode, reflect
The light that never goes off (minutes 42 to 50)
Ask the class to uncover the sensor. The light stays on: the human nightlight's question, now on real hardware. The rule runs while the room is dark, then stops, and nothing tells the light to go off.
The LED Control card is locked too, because a rule owns the light while it watches. The ⏹️ button on the Nightlight row (Stop Monitoring) frees it, and ▶️ lets the rule watch again.
The fix is a second rule, from Lesson 27, Range Logic:
- 1
Create a rule called Morning, with Loop Mode set to Condition.
- 2
Set Sensor to Light Level (LDR), Operator to Greater than (>) and Threshold to 60. It must sit below your room reading.
- 3
Add one step, Action LED Off with Delay (ms) 100, and save it.
Now test three readings, as an engineer would.
| Test | What to do | What should happen | Why |
|---|---|---|---|
| Dark | Cover the sensor fully | Light on | Below 50, Nightlight runs |
| Middle | Cup a hand loosely above it | No change | Between 50 and 60, neither rule runs |
| Bright | Take the hand away | Light off | Above 60, Morning runs |
- Test
- Dark
- What to do
- Cover the sensor fully
- What should happen
- Light on
- Why
- Below 50, Nightlight runs
- Test
- Middle
- What to do
- Cup a hand loosely above it
- What should happen
- No change
- Why
- Between 50 and 60, neither rule runs
- Test
- Bright
- What to do
- Take the hand away
- What should happen
- Light off
- Why
- Above 60, Morning runs
The gap matters. If both rules used one number, a reading wobbling around it would flick the light on and off. Lesson 27 calls this jitter. If the light flickers, edit Nightlight down to 40, as Lesson 27 does. With no kit, the Lesson 27 demo has an "Ultimate Nightlight" example that loads both rules.
With a kit, close the laptop lid and cover the sensor. The light still comes on, because the rules live on the board, not on the laptop.
Guess the loop mode (minutes 50 to 55)
A rule has a loop mode as well as steps: it says when and how often the rule runs. The Nightlight used Condition. The Lesson 21 challenge gives five devices to sort.
| Device | Best loop mode | Why |
|---|---|---|
| A factory siren that blasts until the emergency ends | Forever (or Condition, if a sensor measures the emergency) | It repeats with no break until someone presses Stop |
| A reminder that beeps every 20 minutes to drink water | Timer | It runs, waits the interval, then runs again |
| A streetlight that turns on when it gets dark | Condition | It reacts to a sensor, not to the clock |
| A "System Online" light that shows once when the board starts | No Loop | It runs once, and again at each power-on |
| A greenhouse pump that runs when the soil is too dry | Condition | It reacts to the soil reading |
- Device
- A factory siren that blasts until the emergency ends
- Best loop mode
- Forever (or Condition, if a sensor measures the emergency)
- Why
- It repeats with no break until someone presses Stop
- Device
- A reminder that beeps every 20 minutes to drink water
- Best loop mode
- Timer
- Why
- It runs, waits the interval, then runs again
- Device
- A streetlight that turns on when it gets dark
- Best loop mode
- Condition
- Why
- It reacts to a sensor, not to the clock
- Device
- A "System Online" light that shows once when the board starts
- Best loop mode
- No Loop
- Why
- It runs once, and again at each power-on
- Device
- A greenhouse pump that runs when the soil is too dry
- Best loop mode
- Condition
- Why
- It reacts to the soil reading
The board has no clock, so a Timer rule means "every 20 minutes", never "at 8 o'clock". Our post on forever, timed and conditional loops covers the same four ideas.
Reflect (minutes 55 to 60)
Use three questions adapted from the teacher guide as an exit ticket:
- 1
What does your system sense, decide and do?
- 2
Why did you choose your number?
- 3
Which test failed, and what did you change because of it?
A group that answers the third question has done real computer science: found a bug, explained it and fixed it.
Kit, browser demo or both: choosing your setup
You do not need a full class set of kits. Pick the setup that fits what you have.
| Setup | What you need | What students touch | Before the day | Best for |
|---|---|---|---|---|
| Kits only | 1 kit per 2–3 students, a device per kit, 2.4 GHz Wi-Fi | A real board, light and sensor | Set up and name every board | Schools with a class set |
| Rotation | About half the kits, plus devices for the demo | Real hardware for half the hour | Set up fewer boards | Schools with a few kits |
| Try it demos only | A browser per pair | A simulated board on each lesson page | Open the lesson pages | No kits yet, or home learning |
| Dashboard demo mode | A dashboard, with demo typed as the board's address | Sample readings and live controls | Install one dashboard | A quick teacher preview |
| Screen-only Hour of AI activity | Devices and the catalogue | A tutorial on screen | Pick an activity | Under-10s, or no Wi-Fi the boards can join |
- Setup
- Kits only
- What you need
- 1 kit per 2–3 students, a device per kit, 2.4 GHz Wi-Fi
- What students touch
- A real board, light and sensor
- Before the day
- Set up and name every board
- Best for
- Schools with a class set
- Setup
- Rotation
- What you need
- About half the kits, plus devices for the demo
- What students touch
- Real hardware for half the hour
- Before the day
- Set up fewer boards
- Best for
- Schools with a few kits
- Setup
- Try it demos only
- What you need
- A browser per pair
- What students touch
- A simulated board on each lesson page
- Before the day
- Open the lesson pages
- Best for
- No kits yet, or home learning
- Setup
- Dashboard demo mode
- What you need
- A dashboard, with
demotyped as the board's address - What students touch
- Sample readings and live controls
- Before the day
- Install one dashboard
- Best for
- A quick teacher preview
- Setup
- Screen-only Hour of AI activity
- What you need
- Devices and the catalogue
- What students touch
- A tutorial on screen
- Before the day
- Pick an activity
- Best for
- Under-10s, or no Wi-Fi the boards can join
Demo mode cannot save, start or delete rules, as the documentation says, so it cannot run Part 2; use the lesson-page demos for that. And a simulator is not a circuit. Our coming post on learning ESP32 and Arduino with simulators weighs that trade-off.
How a rotation works
Half A starts on the kits and half B on the demos. At minute 25 they swap, so each half does one part on real hardware. Run the human nightlight for everyone at the swap.
When a screen-only hour is the better choice
A hardware hour needs boards set up, Wi-Fi they can join and a device per group. If your network blocks the boards, a screen tutorial is safer. Under-10s suit the activities for younger ages in the Hour of AI catalogue (opens in a new tab), and a school that wants the 2026 AI theme should pick an Hour of AI activity. This hour also uses menus, not typed code: a step before text code, not a replacement for it. Our post on how no-code rules teach real logic makes that case.
How the hour maps to CSTA standards
If your school reports on the CSTA K-12 computer science standards, this table is our own reading of where the hour touches them, not an official alignment. The CSTA progression chart (opens in a new tab) puts Level 1B at ages 8 to 11 and Level 2 at ages 11 to 14, so a class of 10-year-olds and up spans both.
| Part of the hour | Standard | What it asks, in short |
|---|---|---|
| A click on screen switches a real light | 1B-CS-02 | Model how hardware and software work together as a system |
| The SOS sequence and the Nightlight rule | 1B-AP-10 | Create programs with sequences, events, loops and conditionals |
| The light that never goes off | 1B-AP-15 | Test and debug a program so it runs as intended |
| Testing dark, middle and bright | 2-AP-17 | Systematically test and refine programs with a range of test cases |
| Finding why a switch is locked or a light flickers | 2-CS-03 | Systematically identify and fix problems with computing devices |
- Part of the hour
- A click on screen switches a real light
- Standard
- 1B-CS-02
- What it asks, in short
- Model how hardware and software work together as a system
- Part of the hour
- The SOS sequence and the Nightlight rule
- Standard
- 1B-AP-10
- What it asks, in short
- Create programs with sequences, events, loops and conditionals
- Part of the hour
- The light that never goes off
- Standard
- 1B-AP-15
- What it asks, in short
- Test and debug a program so it runs as intended
- Part of the hour
- Testing dark, middle and bright
- Standard
- 2-AP-17
- What it asks, in short
- Systematically test and refine programs with a range of test cases
- Part of the hour
- Finding why a switch is locked or a light flickers
- Standard
- 2-CS-03
- What it asks, in short
- Systematically identify and fix problems with computing devices
The rules are built from menus, so the programming match is partial. Teachers in Canada and Pakistan can use the same method: list your curriculum's outcomes, then find the minute where students do each one.
Common mistakes that eat the hour
The boards will not join the school Wi-Fi
Symptom: groups are still "connecting" at minute 5. Cause: the network is 5 GHz only, needs a sign-in page or keeps devices apart. Fix: use a separate 2.4 GHz network or a phone hotspot, with the student devices on it too, and test it the day before.
A group tries to use an Android phone
Symptom: the dashboard asks for an add-on that will not install. Cause: Android browsers cannot install the MakerBuddy add-ons. Fix: install the free MakerBuddy app from Google Play on that phone, or give that group a laptop, an iPhone or an iPad.
The rule fires in a bright room, or never fires
Symptom: the light comes on at once, or never. Cause: the operator is the wrong way round, or the threshold is not between the bright and dark readings. Fix: check Less than (<) for a nightlight and measure again. Lesson 26's tip helps: the arrow always points to the smaller number.
The light switch is locked
Symptom: nobody can switch the light off by hand. Cause: a rule owns the light while it is watching. Fix: press ⏹️ on the rule's row, then use the switch.
The next class finds a light that turns on by itself
Symptom: a light glows before anyone builds a rule. Cause: rules are saved on the board and start again at power-on. Fix: delete them in the dashboard between classes. Holding the board's button does not clear rules.
After the hour: where to go next
- The full 32-lesson curriculum is free to read, with or without a kit. Our STEM curriculum guide for a school year of IoT and electronics shows where Lessons 4, 21, 26 and 27 sit in four terms.
- For the logic behind the rules, read if-then statements explained with real sensors, and browse the MakerBuddy blog for guides to the other parts.
- Early finishers can pick a next build from the MakerBuddy project ideas, many of which need no code.
- Keen coders can read the open Arduino code in the documentation. Uploading their own sketch replaces the MakerBuddy firmware until it is uploaded again, so give them a spare board.
FAQ
What is the Hour of Code?
The Hour of Code is a one-hour introduction to computer science that began in 2013 during Computer Science Education Week. Code.org runs it, and anyone can host one in a classroom, library or club. Since late 2025 Code.org calls it the Hour of AI.
Is the Hour of Code now called the Hour of AI?
Yes. Code.org's Hour of AI page says so, and hourofcode.com forwards to hourofai.org. The older coding tutorials are still listed there under Hour of Code Activities. A hardware hour like this one fits under either name.
When is CS Education Week 2026?
CS Education Week is held each year in the week of Grace Hopper's birthday, 9 December. The Hour of AI how-to guide names 7 to 11 December 2026 as the main week. It also says an hour works any time of year, so another week is fine.
Can you do an Hour of Code with hardware instead of a screen tutorial?
Yes. The Hour of AI guide says activities can use any device or none. In this plan, students control a real light by hand, then build an if-then rule that runs on the board by itself.
Do I need coding experience to run this Hour of Code activity?
No. Students use a web dashboard with switches, sliders and menus. Try the steps once yourself the day before, and keep the task card at hand.
Can students do this activity without a kit?
Yes. Lessons 4, 21, 26 and 27 each have a free Try it demo with a simulated board, so every step can run in the browser. Students miss the real light on the desk, so mix in a few kits with a rotation where you can.
What age is this Hour of Code activity for?
The MakerBuddy lessons are written for ages 10 and up, and younger students can join with an adult nearby. The matching CSTA standards sit at Level 1B (ages 8 to 11) and Level 2 (ages 11 to 14).
How many kits do I need for a class of 30?
Plan one kit for every two or three students: 10 kits in threes or 15 in pairs, plus a spare. With fewer kits, run a rotation between kits and the browser demo.
Sources
- CSEdWeek: About Computer Science Education Week (opens in a new tab)
- Code.org: The Hour of AI (opens in a new tab)
- The Hour of AI: How-to guide (opens in a new tab)
- The Hour of AI: Activities (opens in a new tab)
- THE Journal: Code.org Reinvents Hour of Code as Hour of AI (2 October 2025) (opens in a new tab)
- CSTA: Progression of K-12 Computer Science Standards, Revised 2017 (PDF) (opens in a new tab)
- Espressif: Arduino-ESP32 LEDC and analogWrite API (opens in a new tab)




