Skip to content

Commit 4cf083e

Browse files
iFreilichtjgarff
authored andcommitted
Fix Crash in rainbowCycle (jgarff#287)
When running this script, I was getting a TypeError: unsupported operand type(s) for &: 'float' and 'int' on line 64. `//` returns int instead of float like `/` does, which fixes this issue.
1 parent 155a126 commit 4cf083e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/examples/SK6812_strandtest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def rainbowCycle(strip, wait_ms=20, iterations=5):
6262
"""Draw rainbow that uniformly distributes itself across all pixels."""
6363
for j in range(256*iterations):
6464
for i in range(strip.numPixels()):
65-
strip.setPixelColor(i, wheel(((i * 256 / strip.numPixels()) + j) & 255))
65+
strip.setPixelColor(i, wheel(((i * 256 // strip.numPixels()) + j) & 255))
6666
strip.show()
6767
time.sleep(wait_ms/1000.0)
6868

0 commit comments

Comments
 (0)