B31THERMOSTAT
The task
P0 heats C1 through R1, and P1 reads its charge back as a percent of the supply.
Keep CH1 between 2 and 3 volts like a thermostat:
heat until P1 reads 60 percent, then rest until it falls to 40, and repeat.
The board
- Resistors
- R1 2.2 kΩ
- Capacitors
- C1 10 µF
- Probes
- CH1
Key idea
Two waiting loops, one for each direction.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
SUB 60 and JL keep the heater on while the reading is under 60.
Hint 2Show
SUB 40 and JG keep it resting while the reading is over 40.
Solution
Reveal the Full SolutionThe complete program for THERMOSTAT. 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.
Heat to 60 percent, rest to 40.
u1SC-2 standard
MOV A, 1
OUT P0
H: IN P1
SUB 60
JL H
MOV A, 0
OUT P0
L: IN P1
SUB 40
JG L- CYCLES
- 800
- at par
- ENERGY
- 1600
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 10
- at par