Skip to main content

Posts

Showing posts with the label @SCC_Lancaster

Traffic lights - Microbit, GlowBugs and micropython

In a previous post, I got a GlowBug to work with a micro:bit ( http://robotsandphysicalcomputing.blogspot.co.uk/2016/08/microbit-and-glowbug.html ) . In this post, I will show a relatively simple traffic lights system produced by turning off and on the pixels via a micro:bit. Code from microbit import * import neopixel # Setup the Neopixel strip on pin0 with a length of 3 pixels np = neopixel.NeoPixel(pin0, 3) while True:     #red     np[0] = (255, 0, 0)     np[1] = (0,0, 0)     np[2] = (0,0,0)     np.show()     sleep(1000)     #red and orange     np[0] = (255, 0, 0)     np[1] = (255, 69, 0)     np[2] = (0,0,0)     np.show()     sleep(1000)     #green only     np[0] = (0, 0, 0)     np[1] = (0, 0, 0)     np[2] = (0,255,0)     np.show()     sleep(1000)   ...