# Truth table with logical gates for a traffic light

I want to create this truth table:

So I tried this but I was not able to get the last row, which is: While a =1 and b =1 ,yellow = 1 red = 0 and green = 0.
This is my design for it, but I could not make the last row.

Does anyone have a sample or a tip about what I can do to fix this?
Thanks!

• I remember doing a traffic light problem like this in one of my school labs. – user4574 Apr 15 at 13:14
• @user4574 yep it is one of my assignments – John wiliam Apr 15 at 18:14

YELLOW = $$\B\$$.

RED = $$\\bar A\$$.

GREEN = $$\\overline {RED + YELLOW}\$$

Purple is the implied logic for the red light, orange is the implied logic for the yellow light and green is for the green light.

One OR gate and two inverters would do the trick.

• thanks i do not know know much about the gates i i were trying too much things thanks for helping :) i solve it – John wiliam Apr 15 at 11:59

You can write the equations easily from the truth table

$$Red = \bar A$$ $$Yellow = B$$ $$Green = A \land \bar B$$

They can be built the following circuit:

• thanks for the picture :) – John wiliam Apr 15 at 12:00

I do have a tip for you!

Work column by column, not row by row. First, create a circuit for the red light, ignoring the other two lights. Next, do the same for the yellow light. Finally, do the same for the green light. After you've created these three circuits, you can simply combine them into one.

• thanks for the advice :) – John wiliam Apr 15 at 18:13

I will be honest and say, i am not all that good at designing logic diagrams, way too long since i had it in school. But there is one thing i remember: Logic Friday. Its a freeware program that is an immense help when designing such diagrams and solving the equations. Using Logic Friday, i got these results:

A - input 1

B - input 2

F3 - red

F4 - yellow

F5 - green

Logic input gave me this truthtable after minimizing:

F3 = A';

F4 = B;

F5 = A B';

And this diagram followed:

I know a program like this is no substitute for real knowledge, but it works for a home fiddler like me.

Good luck :)

• thanks for the help :) – John wiliam Apr 16 at 19:13