Traffic Light
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
- Micro-bit
- LED lights (red, yellow, green)
- Alligator clips (4 clips)
- Micro-bit charger
- Micro-bit code
- Aluminum (small piece)
Create Code
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
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
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
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
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
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
Now clip the alligator clip to the ground and to the aluminum foil with the LED lights.
All Connected
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
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