Robots and getting computers to work with the physical world is fun; this blog looks at my own personal experimenting and building in this area.
Monday, 1 August 2016
Micro:bit and Glowbug
I saw on Twitter that some people have got the GlowBugs, more commonly used the CodeBugs (http://www.codebug.org.uk/learn/activity/73/glowbugs/), to work with the Micro:bit. Here is my go at doing it. I just wanted to get one GlowBug to flash Red, Green and Blue and keep cycling around.
The start point was to base it on the code from http://microbit-micropython.readthedocs.io/en/latest/neopixel.html for using Python with neopixels. The GlowBugs are essentially a single neopixel. So I connected the Data In to pin 0 and set the strip length to 1 ( np = neopixel.NeoPixel(pin0, 1) ) and then set the colours by setting np[0] to the colour wanted (eg. Red np[0] = (255, 0, 0) ).
from microbit import *
import neopixel
# Setup the Neopixel strip on pin0 with a length of 1 pixel
np = neopixel.NeoPixel(pin0, 1)
while True:
np[0] = (255, 0, 0)
np.show()
sleep(1000)
np[0] = (0, 255, 0)
np.show()
sleep(1000)
np[0] = (0 , 0 , 255)
np.show()
sleep(1000)
Video of it in action.
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Subscribe to:
Post Comments (Atom)
DIY Data Science with microbits
DIY Data Science: A Complete Guide to Data Logging with the Micro:bit V1 Whether you are a STEM teacher looking for a classroom lab solution...
-
In the previous blog posts for this 'series' "It is a good time...." Post 1 looked at the hardware unpinning some of...
-
The Raspberry Pi Foundation recently released a programming activity Alien Language , with support Dale from Machine Learning for Kids , tha...
-
Scratch 3 was launched on 2nd January 2019, so I wanted to know would Webcams still work with Scratch 3 as it did with Scratch 2. For exampl...

No comments:
Post a Comment