Piglow won't turn off


#1

I am new and downloaded a number of examples.py, test.py they all work fine but when I press CTRL C to cancel any of the examples the Piglow led’s stay on after this. Even sudo reboot and the Piglow led’s still stay on. In other words, they stay lit, not flashing on the arm the example sequence happened to be in the moment CTRL C is pressed. Have not changed any example code either. Any ideas to turn them off besides a shutdown? Thanks in advance.
Pi Model B+ with updated Raspbian.


#2

The PiGlow will “Remember” the last settings, even through a reboot of the Pi ( since the PiGlow will retain power ).

To turn off the lights, you’ll need to write a simple Python script and run it to clean up after running the examples. Alternatively you could add code to the end of the examples to turn off the LEDs when they’re done.

Which example are you running? Send a link to the code and I’ll see if I can whip you up some example code to achieve this!


#3

Been enjoying all of Boeeerb’s examples. If you have a code example I could add to the end of them to turn off all led’s with CTRL C or similar that would be great. It would be my first time coding with Python, I’m a complete newbie here, but having a lot of fun. Thanks for taking the time to reply. PS- thanks also to Boeeerb.
https://github.com/Boeeerb/PiGlow


#4

Something like this should do the trick:

from piglow import PiGlow
piglow = PiGlow()
piglow.all(0)

#5

whenever i try to turn it off i get this message!

Python 3.2.3 (default, Mar 1 2013, 11:53:50)
[GCC 4.6.3] on linux2
Type “copyright”, “credits” or “license()” for more information.

from piglow import PiGlow
piglow = PiGlow()
piglow.all(0)

Traceback (most recent call last):
File “<pyshell#0>”, line 1, in
from piglow import PiGlow
ImportError: No module named piglow


#6

Looks like you’re running Python 3 there, try python2 or python instead, since there’s currently no Python 3 compatible PiGlow library as far as I’m aware.

So, open LXterminal and:

sudo python
>>>from piglow import PiGlow
>>>piglow = PiGlow()
>>>>piglow.all(0)