fasten up animation

This commit is contained in:
L3D 2024-03-24 23:30:32 +01:00
parent cc9e38a65e
commit 96cb3061e5
No known key found for this signature in database
GPG key ID: AD65B920933B4B20

View file

@ -9,7 +9,7 @@ from rpi_ws281x import Adafruit_NeoPixel, Color
# NeoPixel configuration # NeoPixel configuration
PIN_NEO_PIXEL = 18 PIN_NEO_PIXEL = 18
NUM_PIXELS = 24 NUM_PIXELS = 24
DELAY_INTERVAL = 0.01 DELAY_INTERVAL = 0.001
# Create NeoPixel object # Create NeoPixel object
NeoPixel = Adafruit_NeoPixel(NUM_PIXELS, PIN_NEO_PIXEL) NeoPixel = Adafruit_NeoPixel(NUM_PIXELS, PIN_NEO_PIXEL)
@ -19,11 +19,12 @@ def wheel(pos):
"""Generate rainbow colors across 0-255 positions.""" """Generate rainbow colors across 0-255 positions."""
pos = pos % 256 # Ensure pos stays within 0-255 range pos = pos % 256 # Ensure pos stays within 0-255 range
if pos < 85: if pos < 85:
return Color(int(pos * 3), int(255 - pos * 3), 0) return Color(pos * 3, 255 - pos * 3, 0)
if pos < 170: pos -= 85
pos -= 85 if pos < 85:
return Color(int(255 - pos * 3), 0, int(pos * 3)) return Color(255 - pos * 3, 0, pos * 3)
return Color(0, int(pos * 3), int(255 - pos * 3)) pos -= 85
return Color(0, pos * 3, 255 - pos * 3)
try: try:
while True: while True: