logic gates to control 2 swiches and 2 lights

121 views Asked by At

I have 2 switches that correspond to 2 lights and I would like to control them with logic gates. My problem starts when a switch is ON and the second one goes into ON as well.

In this condition, I would like the light that was ON to go OFF, and the Second light to go ON, but when the second switch goes OFF. I would like the second light to go OFF but the first one (that switch is still ON) to turn ON.

I tried a lot of combinations between (tristate, flip-flops, NOR, XNOR), but wasn't able to capture the state of the switches in the past. I used some counters as well in order to have some steps between the ON & OFF of the switches, but still no final result. I manage to get one of the switches to correspond ok. but not both of them.

the case scenarios that need to be accomplished are :

1) sw1 = ON
   sw2 = OFF
   L1 = ON
   L2 = OFF

2) sw1 = OFF
   sw2 = ON
   L1 = OFF
   L2 = ON

3) sw1 = ON
   sw2 = from OFF to ON
   L1 = from ON to OFF
   L2 = from OFF to ON
   sw2 = from ON to OFF
   L1 = from OFF to ON
   L2 = from ON to OFF

4) sw1 = from OFF to ON
   sw2 = ON
   L1 = from OFF to ON
   L2 = from ON to OFF
   sw1 = from ON to OFF
   L1 = from ON to OFF
   L2 = from OFF to ON

can anyone help me out here?

I tried AND gates that had one input the switch and the other input was a not gate from the other switch. when both went ON the gates went OFF.

All the other tries got me in conditions 1,2 and then 3 or 4, not all 4

1

There are 1 answers

0
Reinhard Männer On

I think your requirements are contradictory.
First, in your scenarios, L2 is always the inverse of L1. Thus I left it out below for clarity.
Then I rewrote your scenarios in the following way:

a) when
    sw1 = ON
    sw2 = OFF   -> ON
   then
    L1  = ON    -> OFF

b) when
    sw1 = ON
    sw2 = ON    -> OFF
   then
    L1  = OFF   -> ON

c) when
    sw1 = ON    -> OFF
    sw2 = ON
   then
    L1  = ON    -> OFF

d) when
    sw1 = OFF   -> ON
    sw2 = ON
   then
    L1  = OFF   -> ON

Please note that in cases b) and c), sw1 and sw2 are both ON, while L1 is different.
This is a contradiction.
Or did I miss something?