B26ALARM
The task
P0 is an analog input: IN P0 reads its voltage as a percent of the 5 volt supply.
Sound the alarm: light the LED on P1 while the input is above 3 volts.
Keep it dark the rest of the time.
The board
- Sources
- V1 2.5 V triangle at 50 Hz and V2 2.5 V
- Resistors
- R1 330 Ω
- LEDs
- D1 red
- Probes
- CH1 and CH2
Key idea
3 volts is 60 percent of the supply.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Subtract 60. JG jumps when what is left is above 0.
Hint 2Show
A positive A lights the LED as it is. Anything else must become 0 before OUT P1.
Solution
Reveal the Full SolutionThe complete program for ALARM. 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.
The LED lights above 3 volts.
u1SC-2 standard
IN P0
SUB 60
JG W
MOV A, 0
W: OUT P1- CYCLES
- 400
- at par
- ENERGY
- 800
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 5
- at par