paticpatic
Posts: 11
Joined: Mon Feb 23, 2015 4:13 pm

RPi2B Piglow

Sat Mar 14, 2015 1:10 am

Hi, I am running the RASPBIAN V3.18 RPi2B and have the PiGlow LED module. I am looking for simple instructions to load the needed drivers/modifications and an example Python program to use the PiGlow. I am not familiar with the RASPBIAN operating system (Win7 user), but trying to understand this so I can educate my teenage son at some programming ideas. This seems like at good starting tool to hold his interest. Is there some step-by-step instructions I can't run from a terminal window to modify my config files, load needed software, and run an example program? This would be greatly appreciated.
Thanks, Kevin B

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPi2B Piglow

Sat Mar 14, 2015 9:50 am

sudo raspi-config
Go to the advanced options and enable SPI & I2C.

Get the code with
sudo apt-get install python-smbus
cd ~
wget https://raw.githubusercontent.com/pimoroni/piglow/master/examples/piglow-example.py

run it with
python piglow-example.py # you can't use Python3, it won't work
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

paticpatic
Posts: 11
Joined: Mon Feb 23, 2015 4:13 pm

Re: RPi2B Piglow

Sat Mar 14, 2015 3:35 pm

Thanks, I will give this a try.

paticpatic
Posts: 11
Joined: Mon Feb 23, 2015 4:13 pm

Re: RPi2B Piglow

Sun Mar 15, 2015 1:40 am

Doug,

I followed your instructions, but the piglow-example.py file appears to be HTML, not Python? Can you help figure out what I did wrong?


paticpatic
Posts: 11
Joined: Mon Feb 23, 2015 4:13 pm

Re: RPi2B Piglow

Sun Mar 15, 2015 1:59 am

Getting closer...

I save it to piglow1.py. This is what I got when I ran it.

Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>

Traceback (most recent call last):
File "/home/pi/piglow1.py", line 52, in <module>
piglow = PiGlow(1)
File "/home/pi/piglow1.py", line 21, in __init__
self.bus = SMBus(i2c_bus)
IOError: [Errno 13] Permission denied
>>>


I must not be setup properly? Any ideas?
Thanks in advance ...

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: RPi2B Piglow

Sun Mar 15, 2015 8:52 am

The Raspberry Pi Foundation's own tutorial on using the PiGlow suggests that you need to run IDLE with 'admin'/super-user privileges by using

Code: Select all

sudo idle &
http://www.raspberrypi.org/learning/piglow/worksheet/

paticpatic
Posts: 11
Joined: Mon Feb 23, 2015 4:13 pm

Re: RPi2B Piglow

Tue Mar 17, 2015 2:40 pm

Thanks for the help, I have the PiGlow working.

Return to “Beginners”