diff options
author | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2022-12-05 20:24:23 +0100 |
---|---|---|
committer | Jakob Stendahl <jakob.stendahl@outlook.com> | 2022-12-05 20:24:23 +0100 |
commit | 629503252de51f3a95ae3dd19ef837012eea9fc2 (patch) | |
tree | 99de676fa25e12cce33d49e33341caf76b332a50 /NeoRuntime/builtin/candy_cane/script.py | |
parent | dd8d828414583d6993774240d76c2c2782627ef6 (diff) | |
download | Luxcena-Neo-629503252de51f3a95ae3dd19ef837012eea9fc2.tar.gz Luxcena-Neo-629503252de51f3a95ae3dd19ef837012eea9fc2.zip |
Add another builtin, and remove a debug print
Diffstat (limited to 'NeoRuntime/builtin/candy_cane/script.py')
-rw-r--r-- | NeoRuntime/builtin/candy_cane/script.py | 19 |
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 |