B92PORCH LIGHT
The task
P0 reads a motion sensor on CH1 and P1 the daylight on CH2. Sample both on each tick of P3.
While the daylight reads under 30, motion lights the lamp on P2.
The lamp stays lit until 4 ticks pass without motion in the dark.
The board
- Sources
- V1 1 V square at 16.67 Hz, V2 2.5 V square at 125 Hz, V3 2 V sine at 4 Hz, and V4 2.5 V
- Resistors
- R1 330 Ω
- LEDs
- D1 yellow
- Probes
- CH1, CH2, and CH3
Key idea
This is RETRIGGER with a condition: only dark motion sets the count to 4.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Check the daylight first; in daylight, treat the tick as one without motion.
Hint 2Show
Every tick without dark motion counts B down, and the lamp goes out at zero.
Solution
Reveal the Full SolutionThe complete program for PORCH LIGHT. 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.
A retriggerable hold, armed only in the dark.
u1SC-2 standard
L: IN P3
IN P1
SUB 30
JL DK
DEC: MOV A, B
JZ L
SUB 1
S: MOV B, A
OUT P2
JMP L
DK: IN P0
JZ DEC
MOV A, 4
JMP S- CYCLES
- 883
- at par
- ENERGY
- 1766
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 14
- at par