Skip to content

Commit da0ac18

Browse files
author
Ray Bellis
committed
resolve precision error in python example too
1 parent 6fd667b commit da0ac18

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

micropython/examples/plasma_stick/rainbows.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828

2929
SPEED = min(255, max(1, SPEED))
3030
offset += float(SPEED) / 2000.0
31+
offset %= 1
3132

3233
for i in range(NUM_LEDS):
33-
hue = float(i) / NUM_LEDS
34+
hue = (offset + float(i) / NUM_LEDS) % 1
3435
led_strip.set_hsv(i, hue + offset, 1.0, 1.0)
3536

3637
time.sleep(1.0 / UPDATES)

0 commit comments

Comments
 (0)