From 2a05c956fab03b2f8f638a6c51efb0c04e0ccd65 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 17 Jul 2021 12:50:16 -0500 Subject: [PATCH] implement len inside of macropad.pixels --- adafruit_macropad.py | 3 +++ examples/macropad_led_animation_example.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 examples/macropad_led_animation_example.py diff --git a/adafruit_macropad.py b/adafruit_macropad.py index 2843374..9b74e1c 100755 --- a/adafruit_macropad.py +++ b/adafruit_macropad.py @@ -911,6 +911,9 @@ def __getitem__(self, index): def __repr__(self): return self._pixels.__repr__() + def __len__(self): + return len(self._pixels) + @property def auto_write(self): """ diff --git a/examples/macropad_led_animation_example.py b/examples/macropad_led_animation_example.py new file mode 100644 index 0000000..bc0c5be --- /dev/null +++ b/examples/macropad_led_animation_example.py @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2021 Tim Cocks +# SPDX-License-Identifier: MIT + +""" +This simpletest example displays the Blink animation on the +MacroPad neopixels +""" +from adafruit_led_animation.animation.blink import Blink +from adafruit_led_animation.color import BLUE +from adafruit_macropad import MacroPad + +macropad = MacroPad() + +blink = Blink(macropad.pixels, speed=0.5, color=BLUE) + +while True: + blink.animate()