Advertisement
gPiOBox

Beginner - Traffic Lights - micro:bit

Oct 25th, 2017
1,077
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. """
  2. filename:gpio_mb_TrafficLights.py
  3. Beginner Project - Traffic Lights
  4. written by Trevor Olsson
  5. © GPIO Support Services LTD MMXVII
  6. More info here: http://www.gpio.co.uk/traffic-lights/
  7. """
  8. from microbit import *
  9. while True:
  10.     pin8.write_digital(1)
  11.     sleep(2000)
  12.     pin12.write_digital(1)
  13.     sleep(2000)
  14.     pin8.write_digital(0)
  15.     pin12.write_digital(0)
  16.     pin0.write_digital(1)
  17.     sleep(2000)
  18.     pin0.write_digital(0)
  19.     pin12.write_digital(1)
  20.     sleep(2000)
  21.     pin12.write_digital(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement