Files
PowerBank_Python/myws2812.py

30 lines
580 B
Python

# 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)