Scratch GPIO – PiGlow Support
Controlling a Pimoroni PiGlow using ScratchGPIO
This is a little fun add on from the Pimoroni gang www.pimoroni.com with 18 high brightness LEDs on it. [youtube=http://www.youtube.com/watch?v=1jJ349CX2IY]
To get an add-on like this to work on a Raspberry Pi (it uses what’s called the I2C protocol) you need to run a few little things using LX Terminal.
sudo apt-get install i2c-tools
sudo apt-get install python-smbus
and finally a little tool to enable the I2C pins to be used for this purpose
sudo bash pi2c.sh
Then once you’ve rebooted – come back here 🙂
Make sure you’ve installed ScratchGPIO of course
Once you’ve added I2C support to your Raspberry Pi then just create a variable called AddOn and set it to PiGlow as the first line in your Green Flag event.
You can then create variables Led1 to Led18 and set them to values between 0 (for off) to 255 (Fully on). You can also have variables for Red,Orange,Yellow,Green,Blue and White to refer to each of the colours and the the same for Leg1, Leg2 and Leg3.
As usual, you can use also use simple broadcasts instead of creating variables and say things like Broadcast Led1On to switch LED1 on
This script shows a how using the the join statement you can blink each leg in turn without having to use a lot of if statements.
For info – there’s a dead link here:
“Make sure you’ve installed ScratchGPIO of course”
Ta -I’ll get onto it
I’ve put together a box, similar to a FlowGo type box, for use in Primaries with Scratch / Pi. Could you PM me?
I don’t know how to PM via wordpress but you can contact me via twitter @cymplecy or email simplecy at googlemail dot com
Hi Simon tried emailing you, was wondering if you got it? didn’t hear back from you
Thanks for all the hard work.
I’ve very carefully followed the instructions given above (following the links to other pages and checking there are no error messages on each install) hoping the get the PiGlow working for my daughter to play with.
Unfortunately the PiGlow has still not come to life and I wondering how else I can troubleshoot the system.
Any help would be much appreciated.
Can you get it working just using Python?
Unfortunately I’m not familiar with Python, so could you please point me at a link I can follow for the Pi?
That line should read
sudo bash pi2c.sh
Yes – changed – ta 🙂
I cant get the pi glow working with Python,but no luck using ScratchGPIO4 or 4plus. I have followed you instructions to the letter. Any help would be appreciated.
Hi can you switch to ScratchGPIO5 and try that please . Use the plus version please.
I’ll plug one in just to check myself one the England match is over 🙂
Just tried using ScratchGPIO5 Plus and I can switch them alloff and allon
Thanks Simon. Great job.
It was something fun for me to switch on and off the PiGlow LEDs with Python. But it’s even better with Scratch! Looking forward to showing my son this.
Keep up the good work. Valuable resources!
Nice one, got this working last night. It’s great you have put this into Scratch, I am looking forward to combining the real world with some Sprites moving onscreen.
Just not got it fully mastered yet.
I have managed to adjust the brightness with Python, and select all the LED each color, but can’t seem to work out how to do that with Scratch. I have the each Leg, and numbered LED working ok.
If anybody could point me to more examples that would be great.
I” try and add more info in the docs but basically broadcast Red On should turn on all red leds. Create a variable called bright and chamge its value to adjust brightness
Ok, great I will try that. Cheers. ( I am a bit of newbie so need some hand holding, hoped to run through this with my daughter. )