When: After Lesson 15 | Time: Two 2-hour sessions: plan and wire in the first, finish, test and demonstrate in the second | Result: Competent / Not Yet Competent
A workshop extractor fan needs a speed button. The fan is represented by an LED driven with PWM, and a second LED shows when the fan is running. Each press of the button steps the fan OFF → LOW → HIGH and back to OFF. Every change of speed is printed on the Serial Monitor.
What your system must do
Push button on D2, wired to GND, with pinMode INPUT_PULLUP
Fan LED on D6 (PWM): OFF 0 %, LOW 40 % (analogWrite 102), HIGH 100 % (255)
Running LED on D5: on at LOW and HIGH, off at OFF
Each press steps OFF → LOW → HIGH → OFF. One press = one step: use the button code on this brief
Serial at 9600 baud prints one line per change, for example Fan: LOW (40%)
Conditions
Individual work. Show your plan sheet to the assessor before you wire.
Course notes, lesson sketches and Code Along 16.1-16.3 may be used. You must be able to explain your own sketch.
The assessor asks a few questions during the demonstration.
A button bounces, so one press can look like several. Waiting 50 ms after every change hides the bounce. Nothing else has to happen at the same time in this task, so the short delay is fine.
// 1. At the top, with your other variables:
bool lastReading = HIGH; // HIGH = not pressed
// 2. Inside loop():
bool reading = digitalRead(buttonPin);
if (reading != lastReading) { // the button has just changed
if (reading == LOW) {
// just pressed - step to the next speed here
}
delay(50); // let the bounce die away
lastReading = reading;
}
Evidence to submit
The plan sheet on this brief (pins and speeds), initialled before wiring
Your sketch (.ino)
The test table on this brief, filled in
A fault you found and fixed
Plan sheet: pins
Fill in before you wire. The assessor initials it.
Part
Uno pin
Resistor
Button
Fan LED
Running LED
Plan sheet: speeds
Fill in the empty columns before you wire.
Speed now
After one press
Fan D6 (analogWrite)
Running LED D5
Serial line
OFF
LOW
HIGH
Test table
Run every test on your finished build. Write what you really saw, then Pass or Fail.
#
Test
Expected
Observed
Pass?
1
Power on (reset)
Fan off, running LED off, Serial: Fan: OFF (0%)
2
Press once
Fan dim, running LED on, one line: Fan: LOW (40%)
3
Press again
Fan full, one line: Fan: HIGH (100%)
4
Press again
Back to OFF, one line
5
Hold the button for 3 s
One step only, one line
6
From OFF, press 10 times quickly
Exactly 10 lines; ends at LOW
7
Scope on D6 at LOW
About 980 Hz, 40 % duty
A fault I found
Something that did not work at first, and how you found and fixed it.
What went wrong
What I checked
How I fixed it
Assessment criteria
Tick one box per criterion. ★ marks a critical criterion.
#
Criterion
Competent when
Not yet competent if
C
NYC
1
Plan before wiring
Pin and speed tables filled in and shown to the assessor before wiring.
Plan sheet missing, or filled in after wiring.
2
★ Safe build
Each LED has a 330 Ω resistor; the button goes to GND; wiring matches the pin table.
Any LED without a resistor, a short-circuit risk, or wiring that does not match the pin table.
3
★ Button and speeds
Each press steps OFF → LOW → HIGH → OFF with the right brightness and running LED; 10 quick presses give exactly 10 steps; holding gives one step.
A wrong next speed, missed or double steps, or repeats while the button is held.
4
Serial output
One clear line per speed change, and nothing while the button is held.
Missing, repeated or continuous output.
5
Testing
Every row of the test table filled in with what really happened, including the scope reading, and one fault written up.
Rows missing, the observed column copied from the expected column, or no fault written up.
6
Explanation
Explains in own words how a press picks the next speed and why the 50 ms wait is there.
Cannot explain how the sketch decides the speed.
How the result is decided
Each criterion is marked Competent (C) or Not Yet Competent (NYC) on the evidence seen. There are no partial marks.
The overall result is Competent only when every criterion is Competent.
Critical criteria (marked ★) cover safety and the core purpose of the task. They cannot be made up by strong work elsewhere.
A Not Yet Competent result lists the criteria still to meet, written feedback and a reassessment date.
One reassessment is offered, normally in the next buffer session. Only the criteria marked NYC are reassessed.
Assessor guidance
Initial the plan sheet before the learner wires anything.
Run the 10-press test yourself on the learner's board.
Suggested questions: What happens after HIGH? What would happen without the 50 ms wait? Why is Serial printed only when the speed changes?