diff options
author | Jakob Stendahl <JakobS1n@users.noreply.github.com> | 2016-09-30 10:22:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-30 10:22:48 +0200 |
commit | 968ffad2a6dfcab9e97372eff6e1070edb90cf19 (patch) | |
tree | ce2a3b15a86059ffedb8a63f48d07c2005b22382 | |
parent | 77ac60b5a29829bf8d2522d6cac0ce8120009b93 (diff) | |
download | i2c-Neopixel-968ffad2a6dfcab9e97372eff6e1070edb90cf19.tar.gz i2c-Neopixel-968ffad2a6dfcab9e97372eff6e1070edb90cf19.zip |
Update i2cPixel.py
[x] Added blink function
[x] Added return on sensorfunction
-rw-r--r-- | Raspberry Pi/i2cPixel.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Raspberry Pi/i2cPixel.py b/Raspberry Pi/i2cPixel.py index 788c771..936c828 100644 --- a/Raspberry Pi/i2cPixel.py +++ b/Raspberry Pi/i2cPixel.py @@ -34,6 +34,9 @@ def setPixel(n, red, green, blue): def show(): bus.write_byte(arduinoAddress, 0x03) + +def blink(time, red, green, blue): + bus.write_block_data(arduinoAddress, 0x04, [red, green, blue, time]) def waitForSensor(): @@ -41,10 +44,12 @@ def waitForSensor(): try: sensorData = bus.read_byte(arduinoAddress) if sensorData == 0x02: - print "SENSOR 1" + print "Sensor 1 Triggered" + return 1 break; if sensorData == 0x03: - print "SENSOR 2" + print "Sensor 2 Triggered" + return 2 break; except Exception: pass |