From 4a6bf8110f36105bbcbb8b9de4dfbcb367c119b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Fri, 16 Feb 2024 19:20:03 +0100 Subject: [PATCH] updated code for pixel strip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- client/main.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/client/main.py b/client/main.py index 8dc09fd..557559d 100644 --- a/client/main.py +++ b/client/main.py @@ -25,8 +25,7 @@ LEDS_PER_PIXEL = 5 # Global variables for LED strip control global strip -strip = neopixel.NeoPixel(LED_STRIP_PIN, LED_COUNT) -strip.begin() +strip = neopixel.NeoPixel(pin = LED_STRIP_PIN, n = LED_COUNT, auto_write = True, pixel_order = neopixel.RGB) def register_tube(): # Register or reauthenticate the tube with the server @@ -65,10 +64,7 @@ def update_led_strip(r, g, b, dmx_address, strip, LED_PER_PIXEL): pixel_index = i // LEDS_PER_PIXEL dmx_index = dmx_address + (pixel_index * 3) - strip.setPixelColor(i, Color(r, g, b)) - - # Update the LED strip - strip.show() + strip[i] = Color(r, g, b) def mqtt_listner(universe, dmx_address, strip, LEDS_PER_PIXEL): try: