added strope

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-07-25 19:41:33 +02:00
parent be6f16f968
commit 4134a4f0a3
1 changed files with 12 additions and 1 deletions

11
main.py
View File

@ -58,6 +58,15 @@ def setColor(strip, color, wait_ms=10):
strip.show()
time.sleep(wait_ms/1000.0)
def strobe(strip, color):
for i in range(strip.numPixels()):
strip.setPixelColor(i, color)
strip.show()
time.sleep(float(0.01))
for i in range(strip.numPixels()):
strip.setPixelColor(i, Color(0, 0, 0))
strip.show()
def mqtt_on_connect(client, userdata, flags, rc):
client.subscribe("server-rack-led/power")
client.subscribe("server-rack-led/mode")
@ -121,6 +130,8 @@ if __name__ == '__main__':
rainbowCycle(strip)
elif mode == 1:
setColor(strip, Color(int(r), int(g), int(b)))
elif mode == 2:
strobe(strip, Color(int(r), int(g), int(b)))
else:
setColor(strip, Color(0,0,0))