My PiGlow arrived today. I read about it in The Register yesterday and just had to get one. It's a little daughter board which plugs into the GPIO socket and uses I2C to control three spiral arms of six LEDs in (reading out from the centre) white, blue, green, yellow, orange, and red. Each is individually addressable and you can set the brightness value to anything between 0 and 255.
The hard work has been done already, the low level code is in place and various authors have written simple interface scripts in python so within minutes of installing it in our second Pi I was able to prove it worked and set varying brightness levels by colour using their script thus:
Then the next step was seeing if I could get it doing something myself. The minor stumbling block is that I've not programmed in python before but it's only another programming language surely1 and so it turned out to be and before very long I got it doing this which it's still doing as I type:
Still setting all LEDs to the same brightness mind you, not by colour or individually but that's very simple to do. The interest for me is what I do with it next.
I have plans ...
OK, I've now shuffled some things around and also purchased a new 16 port megabit switch so we've enough connections in my study and the Pi is now fastened via two Royal Mail rubber bands to the the mounting arm of my right hand monitor which means that it's leaning back slightly. That's ideal as it means that the PiGlow is more or less pointing at my face. I've also written a script which interprets very simple programs which lets you set the level of each LED individually as this video demonstrates (my phone camera makes it look brighter than it really is, but it's still pretty bright).
The program first tells it to cycle through so all the LEDs are maximum brightness one at a time. It does that about twelve times. It then put the three white LEDs in the centre on at the same time and fades them up to half brightness before running the light out along all three arms simultaneously all at half brightness. Finally it flares the reds to full brightness before fading to black.
So essentially I can do whatever I want this way.
The next step is to make the program syntax smarter. I would like some basic enhancements like "repeat N times the lines in brackets following this line", and to be able to set the level of all LEDs of on colour at once, or all LEDs at once.
|Tags: Raspberry Pi, toys||Written 29/08/13|
You can follow these posts on Twitter at @Wibblings