aboutsummaryrefslogtreecommitdiff
path: root/Raspberry Pi/python.py
diff options
context:
space:
mode:
authorJakob Stendahl <jakob@Jakobs-MacBook-Pro.local>2016-10-18 10:33:32 +0200
committerJakob Stendahl <jakob@Jakobs-MacBook-Pro.local>2016-10-18 10:33:32 +0200
commit44c8940211225e772851b36dc4088f3b6989f5f4 (patch)
tree639cb8f3d11eb858d11167876b4941d0db0f58c0 /Raspberry Pi/python.py
parent1fb2bdefd7627fde5a5adf594926ccc72d99fb19 (diff)
parent175d4b91a2c53f67d6e4efa4fb2e62b753707d18 (diff)
downloadi2c-Neopixel-44c8940211225e772851b36dc4088f3b6989f5f4.tar.gz
i2c-Neopixel-44c8940211225e772851b36dc4088f3b6989f5f4.zip
Merge remote-tracking branch 'origin/master'
# Conflicts: # Raspberry Pi/python.py
Diffstat (limited to 'Raspberry Pi/python.py')
-rw-r--r--Raspberry Pi/python.py37
1 files changed, 30 insertions, 7 deletions
diff --git a/Raspberry Pi/python.py b/Raspberry Pi/python.py
index bdb939e..57cf380 100644
--- a/Raspberry Pi/python.py
+++ b/Raspberry Pi/python.py
@@ -7,15 +7,29 @@ import i2cPixel
""" Decalrations """
pixels = 72 # Change this to the appropriate number for your setup
+pixels = 10
+addresses = [0, 24, 25, 35] # legg til en start og en stopp for hvert trinn
def hexToRgb(value):
value = value.lstrip('#')
lv = len(value)
return tuple(int(value[i:i+lv/3], 16) for i in range(0, lv, lv/3))
+def lightStaircase(direction):
+ repeats = len(addresses)
+ repeats = repeats / 2
+
+ if direction = "up":
+ loopCondition = repeats
+ while loopCondition >> pixels
+
+ else:
+ loopCondition = 0
+
+ return true
+
def setup():
- # Get settings from config.json
-
+
""" Setup i2c communication """
i2cPixel.version()
i2cPixel.setBus(1)
@@ -25,10 +39,17 @@ def main():
""" 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:
+ i2cPixel.waitForSensor()"""
+
+ """ Test, set all pixels to entered color """
while True:
test = raw_input()
colour = hexToRgb(test)
@@ -37,9 +58,11 @@ def main():
while i < pixels:
i2cPixel.setPixel(i, colour[0], colour[1], colour[2])
i = i + 1
- i2cPixel.showPixel()
-
+ i2cPixel.show()
+ i2cPixel.waitForSensor()
+
+
""" Start script """
setup() #configure
main() #Start main