Traffic Light

by moralesal in Teachers > 9

98 Views, 0 Favorites, 0 Comments

Traffic Light

Screenshot 2023-10-16 152145.png
Screenshot 2023-10-16 155122.png

In Micro-bit I created a traffic light simulator. You can control it by selecting the logo, A and B buttons. By pressing on the logo it will act as a pedestrian requesting to cross the street this will make the traffic light to go from ret to green. This will allow pedestrians to cross the street as well. If you select A it will change to yellow and then to red which will alert pedestrians to stop crossing the street.

Supplies

Screenshot 2023-10-16 154752.png
Screenshot 2023-10-16 202252.png
  • Micro-bit
  • LED lights (red, yellow, green)
  • Alligator clips (4 clips)
  • Micro-bit charger
  • Micro-bit code
  • Aluminum (small piece)

Create Code

Screenshot 2023-10-16 202252.png

In micro-bit https://makecode.microbit.org/# create the code shown above. You can modify it as you see fit as long as the code runs. Once the code is created download to the micro-bit.

Micro-bit Instructions

Screenshot 2023-10-16 152411.png

Use the charger to power the micro-bit. Once it is on we are going to star connecting the alligator clips to it.

Red Led Light

Screenshot 2023-10-16 152210.png

P0 is for the red LED light.

  • Clip the alligator clip to P0 and to the positive pin on the LED light (longest).

Add Yellow LED Light

Screenshot 2023-10-16 152235.png

P1 is for the yellow LED light.

  • Clip the alligator clip to P1 and to the positive pin on the LED light(longest).


Add Green LED Light

Screenshot 2023-10-16 152302.png

P2 is for the green LED light.

  • Clip the alligator clip to P2 and to the positive pin on the LED light (longest).


Using Aluminum

Screenshot 2023-10-16 194743.png

Since there is only one alligator clip for the ground wrap the LED pins (short end) to the aluminum just the the above picture.

Connecting LED Lights to Ground

Screenshot 2023-10-16 194810.png

Now clip the alligator clip to the ground and to the aluminum foil with the LED lights.

All Connected

Screenshot 2023-10-16 194855.png
Screenshot 2023-10-16 155122.png

Connect all the LED light to their appropriate current and to the ground. In the first picture you can observe it with the foil but if you do not have foil observe the second picture.

Turn on Micro-bit

Screenshot 2023-10-16 194855.png

Turn on the micro-bit to observe it work.

Instructions:

  • The micro-bit will turn on and tell you to STOP as the light is green (wait)
  • Press on the LOGO and it will to WAIT then Go and the light will turn green.
  • Do not press anything until it tells you to press A.

Thank you