aboutsummaryrefslogtreecommitdiff
path: root/Raspberry Pi
diff options
context:
space:
mode:
Diffstat (limited to 'Raspberry Pi')
-rw-r--r--Raspberry Pi/config.json0
-rw-r--r--Raspberry Pi/python.py12
2 files changed, 9 insertions, 3 deletions
diff --git a/Raspberry Pi/config.json b/Raspberry Pi/config.json
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Raspberry Pi/config.json
diff --git a/Raspberry Pi/python.py b/Raspberry Pi/python.py
index 8ed3130..57cf380 100644
--- a/Raspberry Pi/python.py
+++ b/Raspberry Pi/python.py
@@ -1,9 +1,12 @@
""" Imports """
+import logging
import smbus
import time
+import json
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
@@ -25,13 +28,15 @@ def lightStaircase(direction):
return true
-def main():
+def setup():
""" Setup i2c communication """
i2cPixel.version()
i2cPixel.setBus(1)
i2cPixel.setAddress(0x04)
+def main():
+
""" Wait for heartbeat from Arduino """
while True:
try:
@@ -50,7 +55,7 @@ def main():
colour = hexToRgb(test)
i = 0
- while i < 10:
+ while i < pixels:
i2cPixel.setPixel(i, colour[0], colour[1], colour[2])
i = i + 1
i2cPixel.show()
@@ -59,4 +64,5 @@ def main():
""" Start script """
-main()
+setup() #configure
+main() #Start main