Add initial project files and implement LED control via UART commands

This commit is contained in:
rxf
2025-07-31 17:00:59 +02:00
commit 670eafefa2
7 changed files with 189 additions and 0 deletions

29
myws2812.py Normal file
View File

@@ -0,0 +1,29 @@
# Bibliotheken laden
from machine import Pin
from neopixel import NeoPixel
from time import sleep_ms
# GPIO-Pin für WS2812
pin_np = 28
# Anzahl der LEDs
leds = 3
# Helligkeit: 0 bis 255
brightness = 128
# Geschwindigkeit (Millisekunden)
speed = 200
# Initialisierung WS2812/NeoPixel
np = NeoPixel(Pin(pin_np, Pin.OUT), leds)
# Wiederholung (Endlos-Schleife)
while True:
for i in range (leds):
# Nächste LED einschalten
np[i] = (brightness, brightness, 0)
np.write()
sleep_ms(speed)
# LED zurücksetzen
np[i] = (0, 0, 0)