B23PUSH PULL
The task
V1 drives P0 with a square wave. P1 and P2 each drive an LED.
Light the green LED on P1 while the input is high, and the red LED on P2 while it is low.
A digital output is on for any value but 0, negative values included.
The board
- Sources
- V1 5 V square at 100 Hz
- Resistors
- R1 330 Ω and R2 330 Ω
- LEDs
- D1 green and D2 red
- Probes
- CH1, CH2, and CH3
Key idea
IN P0 gives 1 or 0. The green LED takes it as it is.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
SUB 1 turns 1 into 0 and 0 into minus 1.
Hint 2Show
Minus 1 is not 0, so it lights the red LED.
Solution
Reveal the Full SolutionThe complete program for PUSH PULL. 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.
Green follows the input, red shows the opposite.
u1SC-2 standard
IN P0
OUT P1
SUB 1
OUT P2- CYCLES
- 400
- at par
- ENERGY
- 800
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 4
- at par