- 
                Notifications
    
You must be signed in to change notification settings  - Fork 46
 
Open
Description
A user commented on this: https://forums.adafruit.com/viewtopic.php?f=60&t=186732
This (simplified) example, after the first round, does the red and blue animations in random order. Each Pulse animation is correct, but, successive Pulses do not strictly alternate between red and blue. Note the AnimateOnce inside AnimationSequence.
import board
import neopixel
from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.sequence import AnimateOnce
from adafruit_led_animation.color import RED, BLUE
num_pixels = 24
pixels = neopixel.NeoPixel(board.A0, num_pixels, auto_write=False)
pixels.brightness = 0.2
pulse0 = Pulse(pixels, speed=.05, color=RED, period=1)
pulse1 = Pulse(pixels, speed=.05, color=BLUE, period=1)
animations = AnimationSequence(
    AnimateOnce(pulse0,pulse1,),
    auto_clear=True,
    auto_reset=True,
    advance_interval=5,
)
while True:
        animations.animate()Removing the nesting works fine. Red and blue alternate, as expected.
import board
import neopixel
from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.sequence import AnimateOnce
from adafruit_led_animation.color import RED, BLUE
num_pixels = 24
pixels = neopixel.NeoPixel(board.A0, num_pixels, auto_write=False)
pixels.brightness = 0.2
pulse0 = Pulse(pixels, speed=.05, color=RED, period=1)
pulse1 = Pulse(pixels, speed=.05, color=BLUE, period=1)
animations = AnimateOnce(pulse0,pulse1,
                         auto_clear=True,
                         auto_reset=True,
                         advance_interval=5,
)
while True:
        animations.animate()Metadata
Metadata
Assignees
Labels
No labels