One LED, three messages
Turn your working LED into a clear status indicator. Build three signals, test whether a partner can recognize them, and improve one using evidence.
For this lesson
Read the code. Watch the light.
Choose a starting pattern. Play it to see the code and light together, or use Step to pause at each delay. Use these examples or adapt them into your own three messages.
Stopped. Choose a message, then press Play.
The LED keeps its last state during delay(). It does not turn off just because the program is waiting.
Reduced motion is on. Use Step to inspect each part without timed flashing.
Follow the instructions
Stoppedvoid showReady() {ledOn();delay(1000);ledOff();}
showReady();call the functiondelay(3000);then wait in darknessStart with the function call in loop(). The program runs the named function, then returns to the next line.
ledOn() and ledOff() represent your own working LED commands. The scaffold below explains how to fill them.
- 1ON · 1000 ms
- 2OFF · 3000 ms · between messages
1000 milliseconds (ms) = 1 second. The short flashes here last 250 ms: one quarter of a second.
One light. A clear message.
A device has one light and no screen. Choose a device and its user, then design signals for ready, working and needs attention. These are imagined device states: your program chooses which message to display; it is not sensing the device or connecting to the internet.
Your code works—but does your user understand it?
Build → test → improve
- 010–5 min
Start with what works
Run your last working blink and save a backup. Keep the same working circuit and settings.
- 025–10 min
Choose your device and user
Choose a device such as a classroom printer, charging station or desk assistant. Explain who uses it and why they need the three messages.
- 0310–17 min
Plan your signal guide
Plan ready, working and needs attention. Record each pattern, every on/off time in milliseconds, and why the patterns should be distinguishable. The examples are starting points you may use or adapt.
- 0417–30 min
Build three named functions
Put each pattern in showReady(), showWorking() or showAttention(). Call them from loop(). Test each pattern. Every signal ends with the light off; leave the same three-second dark gap between messages.
- 0530–34 min
Prepare a fair test
Teach a partner your signal guide and let them practise. Prepare a mixed sequence containing each message twice. Keep the guide visible, but hide the code and message order. Upload once and watch a practice round. Begin scored trial 1 immediately after the long ten-second dark pause at the end of that round.
- 0634–42 min
Record six recognition trials
For each trial, record the intended message, the partner’s answer and any confusion or hesitation. Do not coach them during the test. Count correct answers out of six; honest results matter more than a perfect score.
- 0742–49 min
Revise and retest
Use an observation to change one timing value or pattern feature. If all signals were clear, predict a useful improvement such as a shorter message. Explain the prediction, then run another six trials in a different mixed order. Record whether recognition was better, the same or worse.
- 0849–55 min
Save and explain
Save your final sketch, signal guide, both test records and explanation. Show a teacher your working signals, or record a short video. If sharing a board, keep your own code and evidence.
Give each message a name
A function lets you name a set of instructions, then ask the program to run it. You already have working instructions to turn your LED on and off. Today you will group them into messages.
void showReady() {
// Instructions for the ready signal
}The definition says what happens.
showReady();The call runs those instructions, then continues with the next line.
New to these code words? Read the quick guide.
- Function
- A named group of instructions. Writing void showReady() { ... } defines what the function does. Writing showReady(); calls it: the program runs those instructions, then returns to the next line.
- void
- This function performs instructions without returning a value.
- Braces and semicolons
- The braces { } contain a function’s instructions. A function call such as showReady(); ends with a semicolon. Put new functions outside setup() and loop(), not inside their braces.
- delay
- delay(1000); pauses the program for 1000 milliseconds, which is one second. An on-delay controls how long the light stays lit; an off-delay controls darkness.
- setup and loop
- Keep your existing setup() and pin declarations. setup() runs once when the program starts. loop() runs repeatedly, so the six-message test round repeats.
Your starting code
Fill the two helpers before uploading
ledOn() and ledOff() below are empty. They cannot control your LED until you copy in the exact ON and OFF statements from your own working sketch. Keep your pin declarations and setup(). Replace your old loop(); do not add a second one.
- Keep the pin declarations and setup() from your successful blink sketch. Delete your old loop(), then paste the complete code block after the closing brace of setup().
- Copy your existing LED ON statement into ledOn() and your existing LED OFF statement into ledOff(). These empty helpers do nothing until you fill them. For example, copy digitalWrite(LED, HIGH); only if that is already your working ON instruction. Preserve your own pin name and on/off levels.
- Check that there is exactly one setup() and one loop(). Save, verify and upload. After watching a practice round, begin scored trial 1 immediately after the long ten-second dark pause.
- Adapt the signal timings to your design. For the second test, rearrange the six calls so each still appears twice. Keep five 3000 ms gaps and the final 10000 ms round-ending gap.
// Keep your existing pin declarations and setup() unchanged.
// Do not add a second setup() or a second loop().
// Add these two small helper functions OUTSIDE setup() and loop().
void ledOn() {
// Paste the exact LED ON instruction from your working sketch here.
}
void ledOff() {
// Paste the exact LED OFF instruction from your working sketch here.
}
// Each signal function ends with the light OFF.
void showReady() {
ledOn();
delay(1000);
ledOff();
}
void showWorking() {
ledOn(); delay(250);
ledOff(); delay(250);
ledOn(); delay(250);
ledOff(); delay(250);
ledOn(); delay(250);
ledOff();
}
void showAttention() {
ledOn(); delay(250);
ledOff(); delay(250);
ledOn(); delay(250);
ledOff(); delay(250);
ledOn(); delay(1000);
ledOff();
}
// REPLACE your old loop() with this one.
// Each message occurs twice. Hide this order from your partner.
void loop() {
showWorking(); delay(3000);
showReady(); delay(3000);
showAttention(); delay(3000);
showReady(); delay(3000);
showAttention(); delay(3000);
showWorking(); delay(10000); // Longer darkness ends the test round.
}
Copy these functions into your working sketch. This scaffold is not a complete replacement sketch.
You may ask AI to help organize your existing working code into functions. Tell it to preserve the LED pin, board setup and on/off commands. Check the result yourself and be ready to explain one call and one delay.
Test the message, not their memory
Guide visible
Teach your partner the signals and let them practise. Keep the signal guide where they can see it.
Order hidden
Use each message twice in a mixed order. Hide the code and sequence, and do not coach your partner.
Change, then retest
Revise one feature using an observation or prediction. Test six more messages in a different mixed order.
Make the rounds clear: after practising, wait for the ten-second dark gap. The next signal is trial 1. Leave three seconds of darkness between messages and ten seconds after the sixth message. That longer gap tells your partner the round has ended.
Record this for every trial
Use the tables in your handout. Compare your correct answers out of six before and after the change. Honest results matter more than a perfect score.
Your classroom score
Each row earns 1 point when the evidence is shown, or 0 if it is not yet shown. Total: 8 points. This is a formative classroom task score, not an official MYP criterion level. Recognition results do not have to be 6 out of 6, and a revision does not have to improve the result to earn credit. Explain what actually happened.
- 11 point
Purpose and signal guide
Name a device and user; record all three messages with their patterns and timing values.
- 21 point
Three working signals
Demonstrate three planned patterns, each with a different timing or flash sequence, on your working or shared setup. Leave an off gap between messages.
- 31 point
Organized code
Use three named signal functions and call them from loop(). Scaffolding or AI help is allowed.
- 41 point
Explain the code
Correctly explain one function call and one delay value in your own code, in writing or aloud.
- 51 point
First test record
Record six intended messages, six partner answers and at least one specific observation. The guide is visible and the order hidden.
- 61 point
A justified revision
Change one timing value or pattern feature and explain why the first test or a stated prediction supports that change.
- 71 point
Retest and compare
Record another six trials in a different mixed order. Compare the two results honestly and explain what they suggest.
- 81 point
Complete evidence
Save your final .ino code, guide, both test records and a demonstration or teacher check.
Keep the evidence together
- Final sketch folder including the .ino file
- Signal guide with timings
- Two six-trial test records and a justified revision
- Teacher-witnessed demonstration or short video
Be ready to explain
“We changed ______ because ______. In the second test, ______. This suggests ______.”
Read the handout text online
One LED three messages
Grade 10 Design | 23 September 2026 | 55 minutes | Task score out of 8
Turn your working LED into a clear status indicator. Build three signals, test whether a partner can recognize them, and improve one using evidence.
Name __________________________________ Class __________ Date ______________
Start with your working blink
Use your existing working ESP32, computer and LED setup. Keep the same wiring, LED pin, on/off commands and successful board settings. No extra components or new connections are needed.
Run your last working blink, save a backup, then work in a new sketch called G10_Three_Messages_Name. Keep any existing current-limiting resistor in your external LED circuit. If a setup stops working, ask your teacher and test your own code on a working shared setup.
Design a status indicator
A device has one light and no screen. Choose a device and its user, then design signals for ready, working and needs attention. These are imagined device states: your program chooses which message to display; it is not sensing the device or connecting to the internet.
My device and its user
________________________________________________________________________________
Why does this user need these messages?
________________________________________________________________________________
Plan your signal guide
Record the flashes and every on/off time. Use milliseconds: 1000 ms = 1 second. Make the patterns easy to tell apart. Each ends with the LED off.
| Message | Flash pattern and on/off times in milliseconds |
| Ready | |
| Working | |
| Needs attention |
Starting ideas: one long flash; three short flashes; two short flashes then one long flash. The scaffold uses 1000 ms for a long flash and 250 ms for a short flash and internal dark gap. You may adapt these.
Today: 0-5 min backup / 5-10 device and user / 10-17 plan / 17-30 code30-34 prepare test / 34-42 test / 42-49 revise and retest / 49-55 save
Build your signals with functions
A function gives a name to a group of instructions. You can then run that group by writing its name. You will use one function for each message so your program is easier to read and change.
Function. A named group of instructions. Writing void showReady() { ... } defines what the function does. Writing showReady(); calls it: the program runs those instructions, then returns to the next line.
void. This function performs instructions without returning a value.
Braces and semicolons. The braces { } contain a function’s instructions. A function call such as showReady(); ends with a semicolon. Put new functions outside setup() and loop(), not inside their braces.
delay. delay(1000); pauses the program for 1000 milliseconds, which is one second. An on-delay controls how long the light stays lit; an off-delay controls darkness.
setup and loop. Keep your existing setup() and pin declarations. setup() runs once when the program starts. loop() runs repeatedly, so the six-message test round repeats.
Use the scaffold on the next page
1. Keep the pin declarations and setup() from your successful blink sketch. Delete your old loop(), then paste the complete code block after the closing brace of setup().
2. Copy your existing LED ON statement into ledOn() and your existing LED OFF statement into ledOff(). These empty helpers do nothing until you fill them. For example, copy digitalWrite(LED, HIGH); only if that is already your working ON instruction. Preserve your own pin name and on/off levels.
3. Check that there is exactly one setup() and one loop(). Save, verify and upload. After watching a practice round, begin scored trial 1 immediately after the long ten-second dark pause.
4. Adapt the signal timings to your design. For the second test, rearrange the six calls so each still appears twice. Keep five 3000 ms gaps and the final 10000 ms round-ending gap.
The two helper functions ledOn() and ledOff() are small named groups too. Each contains your own working instruction. Their names let the signal functions use your hardware without guessing its pin or on/off levels.
Check your understanding
Choose one function call from your code. What happens when the program reaches it?
________________________________________________________________________________
________________________________________________________________________________
Choose one delay value. How many milliseconds is it, and is the light on or off?
________________________________________________________________________________
________________________________________________________________________________
You may ask AI to help organize your existing working code into functions. Tell it to preserve the LED pin, board setup and on/off commands. Check the result yourself and be ready to explain one call and one delay.
Signal scaffold reference
This is part of your existing sketch, not a complete replacement file. Keep your pin declarations and setup(). Delete the old loop(), paste this block, then fill both empty helpers.
// Keep your existing pin declarations and setup() unchanged.
// Do not add a second setup() or a second loop().
// Add these two small helper functions OUTSIDE setup() and loop().
void ledOn() {
// Paste the exact LED ON instruction from your working sketch here.
}
void ledOff() {
// Paste the exact LED OFF instruction from your working sketch here.
}
// Each signal function ends with the light OFF.
void showReady() {
ledOn();
delay(1000);
ledOff();
}
void showWorking() {
ledOn(); delay(250);
ledOff(); delay(250);
ledOn(); delay(250);
ledOff(); delay(250);
ledOn(); delay(250);
ledOff();
}
void showAttention() {
ledOn(); delay(250);
ledOff(); delay(250);
ledOn(); delay(250);
ledOff(); delay(250);
ledOn(); delay(1000);
ledOff();
}
// REPLACE your old loop() with this one.
// Each message occurs twice. Hide this order from your partner.
void loop() {
showWorking(); delay(3000);
showReady(); delay(3000);
showAttention(); delay(3000);
showReady(); delay(3000);
showAttention(); delay(3000);
showWorking(); delay(10000); // Longer darkness ends the test round.
}
The 3000 ms dark gaps separate messages. After the sixth message, 10000 ms of darkness ends the round. Then loop() repeats it. Practise once, then begin scored trial 1 immediately after the long dark pause.
Online lesson and copyable code: mistera.tech/curriculum/lessons/grade-10-one-led-three-messages/
Test the signals with a partner
Show your partner the guide and practise once. Keep the guide visible; hide the code and order. Each round has six messages in mixed order, each appearing twice. Start trial 1 after the long ten-second dark pause. Do not coach your partner. Write at least one specific observation.
Partner ______________________________ First test correct answers ______ / 6
| Trial | Intended message | Partner answer | Hesitation or confusion |
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 |
Change one timing or pattern feature. What did you change, and why?
________________________________________________________________________________
________________________________________________________________________________
Use a first-test observation to justify the change. If all signals were clear, predict a useful improvement such as a shorter message, then test that prediction.
Retest in a different mixed order
Keep the guide visible and hide the new order. Each message still appears twice.
| Trial | Intended message | Partner answer | Hesitation or confusion |
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 |
Retest correct answers ______ / 6. Recognition was: better / the same / worse.
What do the results suggest about your change?
________________________________________________________________________________
Show what you learned
In the final six minutes, save your final sketch, signal guide, both test records and explanation. Show a teacher the three working signals, or record a short video. If sharing a board, keep your own code and evidence.
Your task score out of 8
Each row earns 1 point when the evidence is shown, or 0 if it is not yet shown. Total: 8 points. This is a formative classroom task score, not an official MYP criterion level. Recognition results do not have to be 6 out of 6, and a revision does not have to improve the result to earn credit. Explain what actually happened.
| What you show | Evidence for one point | Score |
| Purpose and signal guide | Name a device and user; record all three messages with their patterns and timing values. | / 1 |
| Three working signals | Demonstrate three planned patterns, each with a different timing or flash sequence, on your working or shared setup. Leave an off gap between messages. | / 1 |
| Organized code | Use three named signal functions and call them from loop(). Scaffolding or AI help is allowed. | / 1 |
| Explain the code | Correctly explain one function call and one delay value in your own code, in writing or aloud. | / 1 |
| First test record | Record six intended messages, six partner answers and at least one specific observation. The guide is visible and the order hidden. | / 1 |
| A justified revision | Change one timing value or pattern feature and explain why the first test or a stated prediction supports that change. | / 1 |
| Retest and compare | Record another six trials in a different mixed order. Compare the two results honestly and explain what they suggest. | / 1 |
| Complete evidence | Save your final .ino code, guide, both test records and a demonstration or teacher check. | / 1 |
Total ______ / 8
Save your final sketch folder including the .ino file, this guide and test record, and a demonstration or teacher check. There is no extra hardware task today.
One thing I can now explain or do independently
________________________________________________________________________________
________________________________________________________________________________
Teacher feedback or next step
________________________________________________________________________________
________________________________________________________________________________