B32ENABLE
The task
P0 reads an enable switch, a slow square wave from V1. P2 ticks every 20 cycles.
While the switch is on, blink the LED on P1: lit on odd ticks, dark on even ones.
While it is off, keep the LED dark. Check the switch on each tick.
The board
- Sources
- V1 5 V square at 25 Hz
- Resistors
- R1 330 Ω
- LEDs
- D1 green
- Probes
- CH1 and CH2
Key idea
IN P2 gives the count of ticks so far. MOD 2 makes it 1 on odd ticks and 0 on even ones.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
MOV B, A keeps the blink while you read the switch.
Hint 2Show
When the switch reads 0, write that 0 instead of the blink.
Solution
Reveal the Full SolutionThe complete program for ENABLE. Open it only when you want the answer.
The reference program
The game's own solution. It passes every test and scores exactly par on every benchmark.
Blink on the ticks while the switch is on.
u1SC-2 standard
IN P2
MOD 2
MOV B, A
IN P0
JZ W
MOV A, B
W: OUT P1- CYCLES
- 254
- at par
- ENERGY
- 508
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 7
- at par