aboutsummaryrefslogtreecommitdiff
path: root/NeoRuntime
diff options
context:
space:
mode:
Diffstat (limited to 'NeoRuntime')
-rw-r--r--NeoRuntime/builtin/candy_cane/script.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/NeoRuntime/builtin/candy_cane/script.py b/NeoRuntime/builtin/candy_cane/script.py
new file mode 100644
index 0000000..5899d92
--- /dev/null
+++ b/NeoRuntime/builtin/candy_cane/script.py
@@ -0,0 +1,19 @@
+from luxcena_neo import NeoBehaviour, ColorVariable, IntegerVariable
+
+class Main(NeoBehaviour):
+
+ def declare_variables(self):
+ self.declare(ColorVariable("Color 1", "#ff0000"))
+ self.declare(ColorVariable("Color 2", "#ffffff"))
+ self.declare(IntegerVariable("LED Groups", 3, min_val=1, max_val=10))
+
+ def update_self(self):
+ N = self.var["LED Groups"].value
+ for i in range(strip.num_pixels()):
+ c = self.var["Color 1"].value if i % (2 * N) < N else self.var["Color 2"].value
+ strip.set_pixel_color(i, c)
+ strip.show()
+
+ def each_tick(self):
+ self.update_self()
+ \ No newline at end of file