Skip to content

Commit 6fd667b

Browse files
author
Ray Bellis
committed
fix hue errors in plasma_stick_rainbows
1 parent b4451c3 commit 6fd667b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/plasma_stick/plasma_stick_rainbows.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ int main() {
3434
while(true) {
3535

3636
offset += float(SPEED) / 2000.0f;
37+
if (offset > 1.0) {
38+
offset -= 1.0;
39+
}
3740

3841
for(auto i = 0u; i < NUM_LEDS; ++i) {
3942
float hue = float(i) / NUM_LEDS;
40-
led_strip.set_hsv(i, hue + offset, 1.0f, 1.0f);
43+
hue += offset;
44+
hue -= floor(hue);
45+
led_strip.set_hsv(i, hue, 1.0f, 1.0f);
4146
}
4247

4348
sleep_ms(1000 / UPDATES);

0 commit comments

Comments
 (0)