/ microbit monday

Christmas Noise!

What do you think of when someone says "Christmas?"

Mince pies, snow, jolly fat man delivering presents, Mariah Carey on endless loop in department stores?

Well dear reader, you know me...I think of neopixels!

IMG_20181217_213233--2-

So when Gareth from 4tronix sent me his latest version of Music:Box I had to take a look...as it comes with three interchangeable neopixel Christmas ornaments.

IMG_20181217_213335--2-
So Music:Box is a micro:bit add on that provides an edge connector interface to a buzzer, connected to P0, and a breakout for three interchangeable neopixel ornaments.
IMG_20181217_213723--2-
Around the back there is also a 3 x AAA battery box to power the Music:Box when away from a computer.

Programming the board is accomplished using the Makecode blocks editor, or via MicroPython. Both ways are really simple!

To illustrate I wrote a very quick script to flash the neopixels on the Christmas tree ornament and play The Entertainer tune everytime button A is pressed.

Christmas tune code

And here is the same code in MicroPython.

Christmas tunes in MicroPython

Oh and if you would like the code, well here you go!

from microbit import *
import random
import neopixel
import music
import time
np = neopixel.NeoPixel(pin1, 10)

while True:
    if button_a.was_pressed():
        music.play(music.ENTERTAINER, wait=False, loop=False)
        for i in range(10):
            np[i] = (255,0,0)
            np.show()
            time.sleep(0.1)
        time.sleep(0.5)
        for i in range(10):
            np[i] = (0,0,0)
            np.show()

So where can you buy one?

From the 4tronix website of course and they are on sale right now (17/12/18) for £13.50! So act fast, get them before Christmas and make lots of noise this Christmas!