summaryrefslogtreecommitdiffstats
path: root/prog/jelka/jelka_hardware.py
diff options
context:
space:
mode:
Diffstat (limited to 'prog/jelka/jelka_hardware.py')
-rw-r--r--prog/jelka/jelka_hardware.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/prog/jelka/jelka_hardware.py b/prog/jelka/jelka_hardware.py
new file mode 100644
index 0000000..7361ed7
--- /dev/null
+++ b/prog/jelka/jelka_hardware.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python3
+import jelka_config
+from sys import argv
+from rpi_ws281x import PixelStrip, Color
+
+LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
+LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
+LED_DMA = 10 # DMA channel to use for generating signal (try 10)
+LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest
+LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
+LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
+
+luči = LED_COUNT
+
+strip = PixelStrip(luči, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
+strip.begin()
+
+def nastavi(luč, barva):
+ strip.setPixelColor(luč, Color(barva[0], barva[1], barva[2]))
+
+def izriši():
+ strip.show()
+
+if __name__ == '__main__':
+ print(argv[0] + "hardware test ...")
+ i = 0
+ try:
+ while True:
+ for k in range(luči):
+ if (i % 2 == 0):
+ strip.setPixelColor(k, Color(255, 255, 255))
+ else:
+ strip.setPixelColor(k, Color(0, 0, 0))
+ strip.show()
+ time.sleep(0.1)
+ i += 1
+
+ except KeyboardInterrupt:
+ pass