From a036a5a30c5154ae9e6be1192f8e76fe3a250b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sat, 17 Feb 2024 12:32:02 +0100 Subject: [PATCH] added neo pix module back and also changed pin 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, 3 insertions(+), 5 deletions(-) diff --git a/client/main.py b/client/main.py index be9f14b..83b53eb 100644 --- a/client/main.py +++ b/client/main.py @@ -1,6 +1,6 @@ import os import subprocess -from rpi_ws281x import Adafruit_NeoPixel, ws +import neopixel import requests import json import time @@ -26,8 +26,7 @@ LEDS_PER_PIXEL = 5 # Global variables for LED strip control global strip -strip = Adafruit_NeoPixel(LED_COUNT, 18, 800000, 5, False, 255, 0) -strip.begin() +strip = neopixel.NeoPixel(pin = board.D10, n = LED_COUNT, auto_write = True, pixel_order = neopixel.RGB) def register_tube(): # Register or reauthenticate the tube with the server @@ -60,8 +59,7 @@ def is_connected_to_wifi(): return output.split('"')[1] def update_led_strip(rgb_values, pixel, strip): - print(*rgb_values) - strip.setPixelColorRGB(int(pixel), *rgb_values) + strip[int(pixel)] = rgb_values def on_message(mqttc, obj, msg): rgb_values = (*ast.literal_eval(msg.payload.decode()), )