Home » Programacion » Facilino » Facilino Ejemplo » Traffic Light Crossing with Facilino

Traffic Light Crossing with Facilino

In this post, we will show a simple traffic light crossing example with Facilino using colour LEDs.

The aim is to control a traffic light crossing. So, we assume that we have a traffic light with three possible colours as shown in the figure, where green means that you can drive, yellow means that you should slow down and red means to stop.

We have 6 colour LEDs, each traffic light has one of each colours. So, traffic lights TL1 and TL2, are placed in a crossing and the following behaviour must be satisfied:

  • TL1 in read and TL2 in green for 7s.
  • TL2 in yellow and TL1 is still in red for 3s.
  • TL1 in green and TL2 in red for 7s.
  • TL1 in yellow and TL2 is still in red for 3s.

This cycle is repeated forever. The expected behaviour, the red light will be ON for 10s, the yellow light 3s ON and the green light will be ON for 7s.

Circuit

Here we show the proposed circuit diagram. The red, yellow and green LEDs of TL1 are connected to D2, D3 and D4, respectively. The red, yellow and green LEDs of TL2 are connected to pins D5, D& and D7, respectively.

Facilino

Here you can find the solution of the example: