B61BICOLOR
The task
P0 and P1 drive two LEDs back to back. Current flows from the high pin to the low one.
Red lights while P0 is high and P1 low, green the other way round, neither while both are low.
P2 ticks every 20 cycles. Show red for one tick, green for two, then dark for one.
The board
- Resistors
- R1 220 Ω, R3 10 kΩ, and R2 220 Ω
- LEDs
- D1 red and D2 green
- Probes
- CH1
Key idea
CH1 reads about 3.3 volts for red and 1.4 for green; 0 with both pins low, 5 with both high.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Every change sets both pins: lower one before you raise the other, so both are never high.
Hint 2Show
Sleep, raise P0, sleep, lower P0 and raise P1, sleep twice, lower P1.
Solution
Reveal the Full SolutionThe complete program for BICOLOR. 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.
Red, green, green, dark.
u1SC-2 standard
IN P2
MOV A, 1
OUT P0
IN P2
MOV A, 0
OUT P0
MOV A, 1
OUT P1
IN P2
IN P2
MOV A, 0
OUT P1- CYCLES
- 58
- at par
- ENERGY
- 116
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 12
- at par