diff options
author | Jakob Stendahl <JakobS1n@users.noreply.github.com> | 2016-09-23 07:34:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-23 07:34:02 +0200 |
commit | de76400657d7c5e164e2afcddc2f10728b9478e1 (patch) | |
tree | 1b8b8a0373a00b83eab75010836ad412a8496556 /Raspberry Pi | |
parent | 0c0e5022ed2e03e422440fb08cf50a9e550c2673 (diff) | |
download | i2c-Neopixel-de76400657d7c5e164e2afcddc2f10728b9478e1.tar.gz i2c-Neopixel-de76400657d7c5e164e2afcddc2f10728b9478e1.zip |
Update python.py
Diffstat (limited to 'Raspberry Pi')
-rw-r--r-- | Raspberry Pi/python.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Raspberry Pi/python.py b/Raspberry Pi/python.py index 9189f8e..71df0de 100644 --- a/Raspberry Pi/python.py +++ b/Raspberry Pi/python.py @@ -12,28 +12,37 @@ def hexToRgb(value): return tuple(int(value[i:i+lv/3], 16) for i in range(0, lv, lv/3)) def main(): - + """ Setup i2c communication """ i2cPixel.version() i2cPixel.setBus(1) i2cPixel.setAddress(0x04) - + """ Wait for heartbeat from Arduino """ while True: - if i2cPixel.greeting(): - print "Arduino is Online" - break + try: + if i2cPixel.greeting(): + print "Arduino is Online" + break + except Exception: + pass -while True: - test = raw_input() + """while True: + i2cPixel.waitForSensor()""" + + """ Test, set all pixels to entered color """ + while True: + test = raw_input() colour = hexToRgb(test) i = 0 while i < 10: i2cPixel.setPixel(i, colour[0], colour[1], colour[2]) i = i + 1 - i2cPixel.showPixel() - + i2cPixel.show() + i2cPixel.waitForSensor() + + """ Start script """ main() |