/ pimoroni

Red Alert - Work in progress

My love of Star Trek is well known and so when I got the chance to play around with Pimoroni's new Mote lights, well there was only one thing to do. Simulate alert statuses!

alt

Pimoroni's new Mote kit is a light control board powered by an Atmel ATxmega32A4U micro-controller, but it can be programmed from any computer. Windows, Mac, Linux and Raspberry Pi. It comes with it's own Python library that is really easy to use.

Each Mote control board has 4 channels to provide output. And to each channel we can add a 16 pixel APA102 RGB LED, providing plenty of colour options and light.

So anyway back to the tinkering. I installed the Python library, opened IDLE Python editor, and proceeded hacking.

My first test was fun, I had the lights...YAY! But Red Alert is nothing without the sound.

So I used Pygame to add a little sound, that I found from Trekcore website

And the result, well it is this glorious little hack, took me less than an hour to put together, and that included a bit of playing with colours and general blinky messing around.
Here is my code, still not finished as I need to add Yellow and Blue alert...oh and another secret feature for another post :) #Clickbait

from mote import Mote
from time import sleep
import pygame

mote = Mote()

num_pixels = 16

mote.configure_channel(1, num_pixels, False)
mote.configure_channel(2, num_pixels, False)
mote.configure_channel(3, num_pixels, False)
mote.configure_channel(4, num_pixels, False)

red = [255,0,0]
off = [0,0,0]
pygame.mixer.init()
pygame.mixer.music.load("RED.WAV")
try:
    while True:
        pygame.mixer.music.play(1)
        for i in range(num_pixels):
            mote.set_pixel(1,i,255,0,0)
            sleep(0.01)
            mote.set_pixel(2,i,255,0,0)
            sleep(0.01)
            mote.set_pixel(3,i,255,0,0)
            sleep(0.01)
            mote.set_pixel(4,i,255,0,0)
            sleep(0.01)
            mote.show()
        sleep(0.5)
        for i in range(num_pixels):
            mote.set_pixel(1,i,0,0,0)
            mote.set_pixel(2,i,0,0,0)
            mote.set_pixel(3,i,0,0,0)
            mote.set_pixel(4,i,0,0,0)
            mote.show()
        sleep(0.5)
except KeyboardInterrupt:
    print("EXIT")
    for i in range(num_pixels):
        mote.set_pixel(1,i,0,0,0)
        mote.set_pixel(2,i,0,0,0)
        mote.set_pixel(3,i,0,0,0)
        mote.set_pixel(4,i,0,0,0) 
        mote.show()
    

The Mote kit is £40 and you can pick one up from Pimoroni.com