Skip to content

Commit

Permalink
v0.3 commit
Browse files Browse the repository at this point in the history
Added fixes by topshed for enabling LED's and added arm.py
  • Loading branch information
Boeeerb committed Aug 17, 2013
1 parent d614da7 commit c299a42
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 3 deletions.
Binary file added LED_addressing.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed PiGlow_Addressing.jpg
Binary file not shown.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -2,8 +2,14 @@

Here is a small Python module for the PiGlow addon by Pimoroni, it will let you flex the LED muscles of this fantastic addon.

## SN3218 Addressing
<p align="center">
<img src="https://raw.github.com/Boeeerb/PiGlow/master/PiGlow_Addressing.jpg" alt="PiGlow Addressing"/>
<img src="https://raw.github.com/Boeeerb/PiGlow/master/SN3218_addressing.jpg" alt="PiGlow Addressing"/>
</p>

## Python LED Addressing
<p align="center">
<img src="https://raw.github.com/Boeeerb/PiGlow/master/LED_addressing.jpg" alt="PiGlow Addressing"/>
</p>

## Files
Expand Down
Binary file added SN3218_addressing.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions arm.py
@@ -0,0 +1,35 @@
#########################################################
## Set each arm of the PiGlow to a specific brightness ##
## ##
## Example by Jason - @Boeeerb ##
#########################################################

from piglow import PiGlow
from time import sleep

piglow = PiGlow(1)

piglow.all(0)

while True:
piglow.arm(3,0)
piglow.arm(1,20)
sleep(0.5)
piglow.arm(1,0)
piglow.arm(2,20)
sleep(0.5)
piglow.arm(2,0)
piglow.arm(3,20)
sleep(0.5)

piglow.all(0)
piglow.arm1(10)
sleep(0.5)
piglow.all(0)
piglow.arm2(10)
sleep(0.5)
piglow.all(0)
piglow.arm3(10)
sleep(0.5)


1 change: 0 additions & 1 deletion cpu.py
Expand Up @@ -12,7 +12,6 @@

piglow = PiGlow(1)


while True:

cpu = psutil.cpu_percent()
Expand Down
8 changes: 7 additions & 1 deletion piglow.py
@@ -1,8 +1,13 @@
#####################################################
## Python module to control the PiGlow by Pimoroni ##
## ##
## Written by Jason - @Boeeerb - v0.2 15/08/13 ##
## Written by Jason - @Boeeerb - v0.3 17/08/13 ##
#####################################################
##
## v0.3 - Added fix from topshed
## v0.2 - Code cleanup by iiSeymour
## v0.1 - Initial release
##

from smbus import SMBus

Expand All @@ -13,6 +18,7 @@ class PiGlow:

def __init__(self, i2c_bus=1):
self.bus = SMBus(i2c_bus)
self.bus.write_i2c_block_data(0x54, 0x00, [0x01])
self.bus.write_byte_data(0x54, 0x13, 0xFF)
self.bus.write_byte_data(0x54, 0x14, 0xFF)
self.bus.write_byte_data(0x54, 0x15, 0xFF)
Expand Down

0 comments on commit c299a42

Please sign in to comment.