Page 1 of 1
RPi2B Piglow
Posted: Sat Mar 14, 2015 1:10 am
by paticpatic
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
Re: RPi2B Piglow
Posted: Sat Mar 14, 2015 9:50 am
by DougieLawson
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
Re: RPi2B Piglow
Posted: Sat Mar 14, 2015 3:35 pm
by paticpatic
Thanks, I will give this a try.
Re: RPi2B Piglow
Posted: Sun Mar 15, 2015 1:40 am
by paticpatic
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?
Re: RPi2B Piglow
Posted: Sun Mar 15, 2015 1:50 am
by xoopha
Re: RPi2B Piglow
Posted: Sun Mar 15, 2015 1:59 am
by paticpatic
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 ...
Re: RPi2B Piglow
Posted: Sun Mar 15, 2015 8:52 am
by B.Goode
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
http://www.raspberrypi.org/learning/piglow/worksheet/
Re: RPi2B Piglow
Posted: Tue Mar 17, 2015 2:40 pm
by paticpatic
Thanks for the help, I have the PiGlow working.