Showing posts with label glowbug. Show all posts
Showing posts with label glowbug. Show all posts

Monday, 31 October 2016

Simple (and temporary) Halloween Hack


This really is a simple one. A Glowbug (or a NeoPixel) with the data in, Ground and 5v connected pushed into the neck of the balloon, then inflated the balloon. The neck of the balloon and wires are twisted tightly and insulating tape used to provide a bit of a seal.

The data in wire is connected to Pin 0 of a Micro:Bit and the other two wires are attached to the corresponding connections of the Micro:Bit. The code below randomly selects the colours and the length of the delay before changing colour.

from microbit import *
import neopixel, random

np = neopixel.NeoPixel(pin0, 1)

while True:
    rd=random.randint(1,254)
    gr=random.randint(1,254)
    bl=random.randint(1,254)
    t1=random.randint(200,2000)
    np[0] = (rd, gr, bl)
    np.show()
    sleep(t1)

The problem is a slow leak means it only stays inflated for a short while.


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. Twitter @scottturneruon

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.

Monday, 13 June 2016

messing around with Codebug




Codebug is great fun, the Blockly programming is more challenging than Scratch but that is ok. 

As a test a Codebug was used to control two glowbugs (see http://www.codebug.org.uk/learn/activity/74/glowbugs-wearables/#step446 for more details on Glowbugs and working with them on the Codebug). 


Routine

Repeat
  Set the  Glowbugs 0 and 1 to yellow;
  Scroll a message across the 5x5 grid saying yellow;
  if button A is pressed
    Set the Glowbugs 0 and 1 to red;
    Scroll a message across the 5x5 saying red;
  if button B is pressed
    Set the Glowbug 0 to blue;
    Scroll a message across the 5x5 saying blue;  






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.

Remote Data Logging with V1 Microbit

In an earlier post  https://robotsandphysicalcomputing.blogspot.com/2024/08/microbit-v1-datalogging.html  a single microbit was used to log ...