BhavithiranSC LimAdrian
Published © MIT

EDU:BIT Pedestrian Crossing Traffic Light | MicroPython

Guide to program Pedestrian Crossing Traffic Light with EDU:BIT (project kit for micro:bit) using MicroPython

BeginnerFull instructions provided30 minutes74
EDU:BIT Pedestrian Crossing Traffic Light | MicroPython

Things used in this project

Hardware components

EDU:BIT
Cytron Technologies EDU:BIT
×1

Software apps and online services

Mu
Python Editor for micro:bit

Story

Read more

Code

Pedestrian Crossing Traffic Light

Python
This tutorial's full code
from edubit import *

display.show(Image.HAPPY)                            # show happy face on microbit display
while True:
	init()                                       # initialize EDU:BIT
	sets_servo_position(S1, position=0)          # close the pedestrian gate 
	sleep(500)
	set_led(Red, 0)                              
	set_led(Yellow, 0)                           
	set_led(Green, 1)                            # traffic light turns green
	sleep(2000)

	set_led(Red, 0)
	set_led(Yellow, 1)                           # traffic light turns yellow
	set_led(Green, 0)                            
	sleep(1000)

	set_led(Red, 1)                              # traffic light turns red
	set_led(Yellow, 0)
	set_led(Green, 0)
	sleep(500)
	sets_servo_position(S1, position=90)         # open the pedestrian gate
	sleep(2000)

Credits

Bhavithiran

Bhavithiran

10 projects • 1 follower
SC Lim

SC Lim

8 projects • 1 follower
Adrian

Adrian

1 project • 0 followers
Education is my passion, and making is my hobby.

Comments

Add projectSign up / LoginAbout BBC micro:bit