Use two if statements
to create a program that will simulate an SR flip-flop. Use switch 0 to
act as the S input to the flip-flop, and switch 1 to act as the R
input. LED 0 will show the status of Q, and LED 1 will show the status
of Q-not. The program should operate as follows:
- If switch 0 is pressed, LED 0 should go on and LED 1 should
go off.
- When the switch is no longer pressed, LED0 should stay on
and LED1 should stay off.
- If switch 1 is pressed, LED 0 should go off and LED 1
should go on.
- When the switch is no longer pressed, LED0 should stay off
and LED1 should stay on.
- Pressing both switches would represent the illegal
condition when both S and R are high. Assume that this condition will
not happen.
|