Make: micro:bit BFG Dream Jar

For World Book Day my son dressed up as the BFG. So, of course, I had to make him a micro:bit dream jar!

 BUILD

I used the following equipment

  • 1 x pink jar bought from St John’s Hospice charity shop
  • Some bubble wrap
  • 1 x micro:bit
  • 1 x CodeBug GlowBug neopixel http://www.codebug.org.uk/shop/
  • 3 x white crocodile clips

I connected the glowbug to the micro:bit using the crocodile clips.

micro:bit GlowBug
0 Data In
GND GND
3V 5V

I used white crocodile clips so they would be camaflouged in the bubble wrap.

CODE

  1. Create a new variable and call it myLights (Variables > Make a Variable)
  2. Set myLights to RGB Neopixels at P0 using the block below:

dj0

To save battery, the lights only come on when the micro:bit is shaken.

It randomly either shows a dream or a nightmare.

A dream:

The light flash from red, orange, yellow, green, blue 4 times with a pause of 200 milliseconds between them. They then clear.

dj1

A nightmare flashes quickly and randomly between red and white. The brightness is also random:

dj3

I should make my program more efficient by putting clear and show out of the if statement!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s