aboutsummaryrefslogtreecommitdiff
path: root/NeoRuntime
diff options
context:
space:
mode:
authorJakob Stendahl <14180120+JakobST1n@users.noreply.github.com>2021-10-11 08:46:31 +0200
committerGitHub <noreply@github.com>2021-10-11 08:46:31 +0200
commit0c313d3bf124e42b34f14c7056ec7ac941242401 (patch)
treed4dd211361571ddd968c0aa808722a82496d5d77 /NeoRuntime
parentef4d96d3c74e67e6652f85711b05075e91c4760e (diff)
downloadLuxcena-Neo-0c313d3bf124e42b34f14c7056ec7ac941242401.tar.gz
Luxcena-Neo-0c313d3bf124e42b34f14c7056ec7ac941242401.zip
:hammer: Make strandtest actually work
Diffstat (limited to 'NeoRuntime')
-rw-r--r--NeoRuntime/builtin/strandtest/script.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/NeoRuntime/builtin/strandtest/script.py b/NeoRuntime/builtin/strandtest/script.py
index 6d263ab..50bac1e 100644
--- a/NeoRuntime/builtin/strandtest/script.py
+++ b/NeoRuntime/builtin/strandtest/script.py
@@ -1,4 +1,4 @@
-from luxcena_neo import NeoBehaviour, util
+from luxcena_neo import NeoBehaviour, utils
import time
def colorWipe(*color, wait_ms=50):
@@ -22,13 +22,13 @@ def theaterChase(*color, wait_ms=50, iterations=10):
def wheel(pos):
"""Generate rainbow colors across 0-255 positions."""
if pos < 85:
- return Color(pos * 3, 255 - pos * 3, 0)
+ return (pos * 3, 255 - pos * 3, 0)
elif pos < 170:
pos -= 85
- return Color(255 - pos * 3, 0, pos * 3)
+ return (255 - pos * 3, 0, pos * 3)
else:
pos -= 170
- return Color(0, pos * 3, 255 - pos * 3)
+ return (0, pos * 3, 255 - pos * 3)
def rainbow(wait_ms=20, iterations=1):
"""Draw rainbow that fades across all pixels at once."""
@@ -42,7 +42,7 @@ def rainbowCycle(wait_ms=20, iterations=5):
"""Draw rainbow that uniformly distributes itself across all pixels."""
for j in range(256*iterations):
for i in range(strip.num_pixels()):
- strip.set_pixel_color(i, wheel(((i * 256 / strip.num_pixels()) + j) & 255))
+ strip.set_pixel_color(i, wheel(int((i * 256 // strip.num_pixels()) + j) & 255))
strip.show()
time.sleep(wait_ms/1000.0)
@@ -57,20 +57,18 @@ def theaterChaseRainbow(wait_ms=50):
for i in range(0, strip.num_pixels(), 3):
strip.set_pixel_color(i+q, 0)
-
class Main(NeoBehaviour):
def on_start(self):
- # Do an endless loop with some default ixel test patterns
- while True:
- colorWipe(*(255, 0, 0)) # Red wipe
- colorWipe(*(0, 255, 0)) # Blue wipe
- colorWipe(*(0, 0, 255)) # Green wipe
+ colorWipe(*(255, 0, 0)) # Red wipe
+ colorWipe(*(0, 255, 0)) # Blue wipe
+ colorWipe(*(0, 0, 255)) # Green wipe
+ while True:
theaterChase(*(127, 127, 127)) # White theater chase
theaterChase(*(127, 0, 0)) # Red theater chase
theaterChase(*( 0, 0, 127)) # Blue theater chase
rainbow()
rainbowCycle()
- theaterChaseRainbow() \ No newline at end of file
+ theaterChaseRainbow()