Skip to content

Commit

Permalink
Create leds.py
Browse files Browse the repository at this point in the history
Code to turn all LEDs on for 0.5 seconds, and off for 0.5 second, generating a flashing array of LEDs with an appropriate flash rate.
  • Loading branch information
ibanezmatt13 committed Aug 22, 2013
1 parent d29ad23 commit 8ee9248
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions leds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import piface.pfio as pfio

pfio.init()

while True:

# turn LED pins 1 to 10 on
pfio.digital_write(1, 1)
pfio.digital_write(2, 1)
pfio.digital_write(3, 1)
pfio.digital_write(4, 1)
pfio.digital_write(5, 1)
pfio.digital_write(6, 1)
pfio.digital_write(7, 1)
pfio.digital_write(8, 1)
pfio.digital_write(9, 1)
pfio.digital_write(10, 1)

time.sleep(0.5) # LEDs stay on for half a second

# turn LED pins 1 to 10 off
pfio.digital_write(1, 0)
pfio.digital_write(2, 0)
pfio.digital_write(3, 0)
pfio.digital_write(4, 0)
pfio.digital_write(5, 0)
pfio.digital_write(6, 0)
pfio.digital_write(7, 0)
pfio.digital_write(8, 0)
pfio.digital_write(9, 0)
pfio.digital_write(10, 0)

time.sleeo(0.5) # LEDs stay off for half a second

0 comments on commit 8ee9248

Please sign in to comment.