enable.value = False strip = neopixel.NeoPixel(NEOPIXEL_PIN, NUM_PIXELS, brightness=.5, auto_write=False) strip.fill(0) # NeoPixels off ASAP on startup strip.show() # default NeoPixel color is white COLOR = (255, 255, 255) # NeoPixel animations pulse = Pulse(strip, speed=0.05, color=COLOR, period=3) solid = Solid(strip, color=COLOR) comet = Comet(strip, speed=0.05, color=COLOR, tail_length=40) #audio try: from audiocore import WaveFile except ImportError: from audioio import WaveFile try: from audioio import AudioOut except ImportError: try: from audiopwmio import PWMAudioOut as AudioOut except ImportError: pass # not always supported by every board!
auto_write=False) # Setup BLE connection ble = BLERadio() uart = UARTService() advertisement = ProvideServicesAdvertisement(uart) # Setup animations animations = AnimationSequence( AnimationGroup(Blink(cpb.pixels, BLINK_SPEED, BLINK_INITIAL_COLOR), Blink(strip_pixels, BLINK_SPEED, BLINK_INITIAL_COLOR), sync=True), AnimationGroup( Comet(cpb.pixels, COMET_SPEED, color.MAGENTA, tail_length=CPB_COMET_TAIL_LENGTH, bounce=CPB_COMET_BOUNCE), Comet(strip_pixels, COMET_SPEED, color.MAGENTA, tail_length=STRIP_COMET_TAIL_LENGTH, bounce=STRIP_COMET_BOUNCE)), AnimationGroup(Sparkle(cpb.pixels, SPARKLE_SPEED, color.PURPLE), Sparkle(strip_pixels, SPARKLE_SPEED, color.PURPLE)), ) animation_color = None mode = 0 blanked = False
strip_pixels = neopixel.NeoPixel(board.A1, 30, brightness=0.5, auto_write=False) cp.pixels.brightness = 0.5 animations = AnimationSequence( # Synchronized to 0.5 seconds. Ignores the second animation setting of 3 seconds. AnimationGroup( Blink(cp.pixels, 0.5, color.CYAN), Blink(strip_pixels, 3.0, color.AMBER), sync=True, ), # Different speeds AnimationGroup( Comet(cp.pixels, 0.1, color.MAGENTA, tail_length=5), Comet(strip_pixels, 0.01, color.MAGENTA, tail_length=15), ), # Different animations AnimationGroup( Blink(cp.pixels, 0.5, color.JADE), Comet(strip_pixels, 0.05, color.TEAL, tail_length=15), ), # Sequential animations on the built-in NeoPixels then the NeoPixel strip Chase(cp.pixels, 0.05, size=2, spacing=3, color=color.PURPLE), Chase(strip_pixels, 0.05, size=2, spacing=3, color=color.PURPLE), advance_interval=3.0, auto_clear=True, auto_reset=True, )
pixels = neopixel.NeoPixel( data_pin, #pixels = adafruit_dotstar(data_pin, clock_pin, num_pixels, brightness=0.2, auto_write=False) ########################################## def switch_colors(anim): anim.color = colorwheel(random.randint(0, 255)) comet = Comet(pixels, speed=0.03, color=(0, 255, 255), tail_length=6, bounce=False) comet1 = Comet(pixels, speed=0.05, color=(255, 255, 0), tail_length=6, bounce=True) rainbow = Rainbow(pixels, speed=0.1, period=2, step=10) animations = AnimationSequence(comet, comet1, rainbow, advance_interval=6) comet.add_cycle_complete_receiver(switch_colors) comet.notify_cycles = 2 ble = BLERadio() uart_service = UARTService()
bounce=True) rainbow_comet3 = RainbowComet(pixel_map[1], speed=0, tail_length=25, colorwheel_offset=80, step=4, bounce=False) strum = RainbowComet(pixel_map[3], speed=0, tail_length=25, bounce=False, colorwheel_offset=50, step=4) lava = Comet(pixel_map[3], speed=0.01, color=ORANGE, tail_length=40, bounce=False) sparkle = Sparkle(pixel_map[4], speed=0.01, color=BLUE, num_sparkles=10) sparkle2 = Sparkle(pixel_map[1], speed=0.05, color=PURPLE, num_sparkles=4) # Animations Playlist - reorder as desired. AnimationGroups play at the same time animations = AnimationSequence( rainbow, rainbow_chase, rainbow_chase2, chase, lava, rainbow_comet, rainbow_comet2, AnimationGroup(
colors=c, anim_mode="circular") group = displayio.Group(max_size=4) group.append(rect1) group.append(rect2) group.append(rect3) group.append(rect4) display.show(group) pixels = rect1 blink = Blink(pixels, speed=0.5, color=0x00FF00) colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, YELLOW]) comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True) chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE) #pulse = Pulse(pixels, speed=0.1, period=3, color=0x00FF00) sparkle = Sparkle(pixels, speed=0.1, color=PURPLE, num_sparkles=10) solid = Solid(pixels, color=0x00FF00) #rainbow = Rainbow(pixels, speed=0.1, period=2) sparkle_pulse = SparklePulse(pixels, speed=0.1, period=3, color=0x00FF00) rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True) rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=2, step=8) #rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15) custom_color_chase = CustomColorChase(pixels, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE])
# pixel_ringC = PixelSubset(pixels, 75, 91) # 16 pixel ring # pixel_ringD = PixelSubset(pixels, 91, 151) # 60 pixel ring # ---BPM--- BPM = 128 BEAT = 60 / BPM # quarter note beat b16TH = BEAT / 4 # 16TH note b64TH = BEAT / 16 # sixty-fourth # ---Anim Setup--- # heal color mode # Pulse 'speed' = smoothness pulse_rings_m0 = Pulse(pixel_ringsAll, speed=0.01, color=ORANGE, period=BEAT) pulse_jewel_m0 = Pulse(pixel_jewel, speed=0.01, color=ORANGE, period=BEAT) comet_stripA_m0 = Comet( pixel_stripA, speed=b64TH, color=ORANGE, tail_length=9, bounce=False ) comet_stripB_m0 = Comet( pixel_stripB, speed=b64TH, color=ORANGE, tail_length=9, bounce=False ) # speed color mode pulse_rings_m1 = Pulse(pixel_ringsAll, speed=0.02, color=RED, period=BEAT / 2) pulse_jewel_m1 = Pulse(pixel_jewel, speed=0.02, color=RED, period=BEAT / 2) comet_stripA_m1 = Comet( pixel_stripA, speed=b64TH, color=RED, tail_length=9, bounce=False ) comet_stripB_m1 = Comet( pixel_stripB, speed=b64TH, color=RED, tail_length=9, bounce=False )
# Create animations in sequences and groups. animations = AnimationSequence( AnimationGroup( ColorCycle(pixels, cycle_speed, color_cycle_colors), ColorCycle(strip, cycle_speed, color_cycle_colors), sync=True, ), AnimationGroup( Sparkle(pixels, sparkle_speed, sparkle_color, 15), Sparkle(strip, sparkle_speed, sparkle_color, 1), ), AnimationSequence( AnimateOnce( AnimationGroup( Comet(pixels, magtag_comet_speed, comet_one_color, tail_length=magtag_comet_tail), Comet(strip, strip_comet_speed, comet_one_color, tail_length=strip_comet_tail), ), AnimationGroup( Comet(pixels, magtag_comet_speed, comet_two_color, tail_length=magtag_comet_tail), Comet(strip, strip_comet_speed, comet_two_color, tail_length=strip_comet_tail),
from adafruit_led_animation.color import colorwheel from adafruit_led_animation.sequence import AnimationSequence # Not enough memory for these on Gemma M0, Trinket M0, QTPy #from adafruit_led_animation.animation.pulse import Pulse #from adafruit_led_animation.animation.chase import Chase #from adafruit_led_animation.animation.rainbow import Rainbow ########################################## # SET THESE VALUES FOR YOUR BOARD and LEDS data_pin = board.D1 #clock_pin = board.D12 #DotStar num_pixels = 12 # Uncomment the appropriate line below for NeoPixels or DotStar pixels = neopixel.NeoPixel( data_pin, #pixels = adafruit_dotstar(data_pin, clock_pin, num_pixels, brightness=0.2, auto_write=False) ########################################## comet = Comet(pixels, speed=0.05, color=(0, 255, 0), tail_length=5, bounce=True) while True: comet.animate()
print("Response is", cheerlights_update_info) # Get the color from the fetched info for use below. cheerlights_color = cheerlights_update_info[0] # If red, blue or pink, do a comet animation in the specified color. if cheerlights_color in ('red', 'blue', 'pink'): if cheerlights_color == 'red': comet_color = RED elif cheerlights_color == 'blue': comet_color = BLUE elif cheerlights_color == 'pink': comet_color = PINK animations = AnimationSequence( AnimationGroup( Comet(magtag_pixels, 0.3, color=comet_color, tail_length=3), Comet(strip_pixels, 0.05, color=comet_color, tail_length=15), ) ) # If green or orange, do a pulse animation in the specified color. if cheerlights_color in ('green', 'orange'): if cheerlights_color == 'green': pulse_color = GREEN elif cheerlights_color == 'orange': pulse_color = ORANGE animations = AnimationSequence( AnimationGroup( Pulse(magtag_pixels, speed=0.1, color=pulse_color, period=3), Pulse(strip_pixels, speed=0.1, color=pulse_color, period=3), )
PIXEL_PIN = board.D5 SERVO_PIN = board.A2 NUM_PIXELS = 12 ORDER = neopixel.GRB BRIGHTNESS = 0.6 # Initialize servo PWM = pwmio.PWMOut(SERVO_PIN, frequency=50) SERVO = servo.Servo(PWM) # Initialize NeoPixels and animations PIXELS = neopixel.NeoPixel(PIXEL_PIN, NUM_PIXELS, auto_write=False, pixel_order=ORDER) LARSON = Comet(PIXELS, bounce=True, speed=0.6/NUM_PIXELS, tail_length=NUM_PIXELS//2, color=(RED[0] * BRIGHTNESS, # This is a little faster than RED[1] * BRIGHTNESS, # using the NeoPixel brightness RED[2] * BRIGHTNESS)) # setting. SPARKLE = SparklePulse(PIXELS, period=2, speed=0.15, max_intensity=BRIGHTNESS, color=BLUE) ANIMATIONS = AnimationSequence(LARSON, SPARKLE, advance_interval=7, auto_clear=False) SERVO.angle = POSITION = NEXT_POSITION = 90 MOVING = False # Initial state = paused START_TIME = time.monotonic() # Initial time DURATION = 1.0 # Hold initial position for 1 sec while True: # Loop forever... # Move turret -- randomly looks around and pauses
# Update to match the number of NeoPixels you have connected pixel_num = 32 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False) pixel_wing_vertical = helper.PixelMap.vertical_lines( pixels, 8, 4, helper.horizontal_strip_gridmap(8, alternating=False)) pixel_wing_horizontal = helper.PixelMap.horizontal_lines( pixels, 8, 4, helper.horizontal_strip_gridmap(8, alternating=False)) comet_h = Comet(pixel_wing_horizontal, speed=0.1, color=PURPLE, tail_length=3, bounce=True) comet_v = Comet(pixel_wing_vertical, speed=0.1, color=AMBER, tail_length=6, bounce=True) chase_h = Chase(pixel_wing_horizontal, speed=0.1, size=3, spacing=6, color=JADE) rainbow_chase_v = RainbowChase(pixel_wing_vertical, speed=0.1, size=3,
rm1.animate() rm2.animate() rm3.animate() rm4.animate() #-------------------- Infected # Colors G4 = (0, 255, 0, 0) # 4 is tip G3 = (0, 155, 0, 0) G2 = (0, 100, 0, 0) G1 = (0, 55, 0, 0) # Comet pixel_object, speed, color, tail_length=0, reverse=False, bounce=False, name=None, ring=False) TAIL = 6 BOUNCE = False inf1 = Comet(pixel_m1, speed=.09, color=G1, tail_length=TAIL, bounce=BOUNCE) inf2 = Comet(pixel_m2, speed=.1, color=G2, tail_length=TAIL, bounce=BOUNCE) inf3 = Comet(pixel_m3, speed=.08, color=G3, tail_length=TAIL, bounce=BOUNCE) inf4 = Comet(pixel_m4, speed=.15, color=G4, tail_length=TAIL, bounce=BOUNCE) def infected(): inf1.animate() inf2.animate() inf3.animate() inf4.animate() #-------------------- Animation Loop # Animation choices based on 4 button choices # button 1 is on/off (animation 0 or 1)
PIXELS = neopixel.NeoPixel(NEOPIXEL_PIN, NUM_PIXELS, brightness=LEVEL, auto_write=False) # NeoPixels off ASAP on startup cp.pixels.fill(0) # Onboard pixels cp.pixels.show() PIXELS.fill(0) # NeoPixel strip PIXELS.show() ENCODER = rotaryio.IncrementalEncoder(board.A2, board.A3) # LED ANIMATIONS ----------------------------------------------------------- COMET = Comet(PIXELS, speed=SPEED, tail_length=8, color=PURPLE, bounce=True) CP_COMET = Comet(cp.pixels, speed=SPEED, tail_length=8, color=PURPLE, bounce=True) DARK_RINGS = Solid(PIXELS, color=BLACK) DARK_CPB = Solid(cp.pixels, color=BLACK) DARK = AnimationGroup( DARK_RINGS, DARK_CPB, ) # Animations Playlist, reorder as desired. AnimationGroups play at same time ANIMATIONS = AnimationGroup( COMET,
# NeoPixel control pin pixel_pin = board.D5 # Number of pixels in the collar (arranged in two rows) pixel_num = 24 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False) # Create a switch from the ItsyBity's on-board pushbutton to toggle charge mode mode_pin = digitalio.DigitalInOut(board.SWITCH) mode_pin.direction = digitalio.Direction.INPUT mode_pin.pull = digitalio.Pull.UP switch = Debouncer(mode_pin) # Create the animations comet = Comet(pixels, speed=0.06, color=(180,0,255), tail_length=10, bounce=True) chase = Chase(pixels, speed=0.05, size=3, spacing=3, color=(0,255,255), reverse=True) rainbow_comet = RainbowComet(pixels, speed=.06) pulse = Pulse(pixels, speed=.04, color=(255,0,0), period = 0.2) # Our animations sequence seconds_per_animation = 10 animations = AnimationSequence(comet, rainbow_comet, chase, advance_interval=seconds_per_animation, auto_clear=True) # Current display determines whether we are showing the animation sequence or the pulse animation current_display = animations # Mode changes the color of random animations randomly random_color_mode = True def random_animation_color(anims):
auto_write=False) cp.pixels.brightness = 0.5 animations = AnimationSequence( # Synchronized to 0.5 seconds. Ignores the second animation setting of 3 seconds. AnimationGroup( Sparkle(cp.pixels, 0.1, color.GREEN, num_sparkles=1), Sparkle(strip_pixels, 0.1, color.GREEN, num_sparkles=1), ), AnimationGroup( Blink(cp.pixels, 0.25, color.RED), Blink(strip_pixels, 0.25, color.RED), sync=True, ), # Different speeds AnimationGroup( Comet(cp.pixels, 0.05, color.GREEN, tail_length=5), Comet(strip_pixels, 0.05, color.GREEN, tail_length=5), ), AnimationGroup( Pulse(cp.pixels, 0.05, color.RED, period=3), Pulse(strip_pixels, 0.05, color.RED, period=3), ), advance_interval=4.0, auto_clear=True, auto_reset=True, ) while True: animations.animate()
#Setup NeoPixel Grid pixel_wing_vertical = helper.PixelMap.vertical_lines( pixels, 8, 2, helper.horizontal_strip_gridmap(8, alternating=True)) pixel_wing_horizontal = helper.PixelMap.horizontal_lines( pixels, 8, 2, helper.horizontal_strip_gridmap(8, alternating=True)) #Setup LED Animations rainbow = Rainbow(pixels, speed=.001, period=2) pulse = Pulse(pixels, speed=0.1, color=RED, period=3) blink = Blink(pixels, speed=0.5, color=RED) colorcycle = ColorCycle(pixels, speed=0.4, colors=[RED, ORANGE, YELLOW, JADE, BLUE, AQUA, PURPLE]) comet_v = Comet(pixel_wing_vertical, speed=0.05, color=PURPLE, tail_length=6, bounce=True) #Setup the LED Sequences animations = AnimationSequence( rainbow, pulse, comet_v, blink, colorcycle, advance_interval=5.95, ) #Run ze animations! while True:
""" Switch between animations with the Circuit Playground Express/Bluefruit Requires adafruit_led_animation """ from adafruit_circuitplayground import cp import time from adafruit_led_animation.animation.chase import Chase from adafruit_led_animation.animation.comet import Comet from adafruit_led_animation.color import AMBER, JADE chase = Chase(cp.pixels, speed=0.06, size=3, spacing=6, color=AMBER) comet = Comet(cp.pixels, speed=0.02, color=JADE, tail_length=10, bounce=True) anim = comet while True: anim.animate() # lookup buttons to switch between animations buttons = cp.were_pressed if buttons: if 'A' in buttons: anim = chase if 'B' in buttons: anim = comet # the switch sets the brightness if cp.switch: cp.pixels.brightness = 0.2 else: cp.pixels.brightness = 0.8 # for slow animations, sleep a bit, but not too long to read buttons
from adafruit_led_animation.sequence import AnimationSequence from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE # Update to match the pin connected to your NeoPixels pixel_pin = board.D6 # Update to match the number of NeoPixels you have connected pixel_num = 32 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False) blink = Blink(pixels, speed=0.5, color=JADE) colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, ORANGE]) comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True) chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE) pulse = Pulse(pixels, speed=0.1, period=3, color=AMBER) sparkle = Sparkle(pixels, speed=0.1, color=PURPLE, num_sparkles=10) solid = Solid(pixels, color=JADE) rainbow = Rainbow(pixels, speed=0.1, period=2) sparkle_pulse = SparklePulse(pixels, speed=0.1, period=3, color=JADE) rainbow_comet = RainbowComet(pixels, speed=0.1, tail_length=7, bounce=True) rainbow_chase = RainbowChase(pixels, speed=0.1, size=3, spacing=2, step=8) rainbow_sparkle = RainbowSparkle(pixels, speed=0.1, num_sparkles=15) custom_color_chase = CustomColorChase(pixels, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE])
# Display setup matrix = Matrix(bit_depth=5) display = matrix.display # 114 colors is the minimum value for all the rainbow animations. 128 use same memory. rect1 = anisha.Arect(16, 1, 30, 30, outline=0x004000, stroke=2, colors=128) group = displayio.Group() group.append(rect1) display.show(group) blink = Blink(rect1, speed=0.5, color=JADE) colorcycle = ColorCycle(rect1, speed=0.4, colors=[MAGENTA, ORANGE]) comet = Comet(rect1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) chase = Chase(rect1, speed=0.1, size=3, spacing=6, color=WHITE) pulse = Pulse(rect1, speed=0.1, period=3, color=AMBER) sparkle = Sparkle(rect1, speed=0.1, color=PURPLE, num_sparkles=10) solid = Solid(rect1, color=JADE) rainbow = Rainbow(rect1, speed=0.1, period=2) sparkle_pulse = SparklePulse(rect1, speed=0.1, period=3, color=JADE) rainbow_comet = RainbowComet(rect1, speed=0.1, tail_length=7, bounce=True) rainbow_chase = RainbowChase(rect1, speed=0.1, size=3, spacing=2, step=8) rainbow_sparkle = RainbowSparkle(rect1, speed=0.1, num_sparkles=15) custom_color_chase = CustomColorChase(rect1, speed=0.1, size=2, spacing=3, colors=[ORANGE, WHITE, JADE])
strip_pixels = neopixel.NeoPixel(board.D5, STRIP_PIXEL_NUMBER, auto_write=False) # Setup BLE connection ble = BLERadio() uart = UARTService() advertisement = ProvideServicesAdvertisement(uart) # Setup animations animations = AnimationSequence( AnimationGroup(Sparkle(strip_pixels, SPARKLE_SPEED, color.TEAL)), AnimationGroup( Comet(strip_pixels, COMET_SPEED, color.TEAL, tail_length=STRIP_COMET_TAIL_LENGTH, bounce=STRIP_COMET_BOUNCE)), ) animation_color = None mode = 0 blanked = False while True: ble.start_advertising(advertisement) # Start advertising. was_connected = False while not was_connected or ble.connected: if not blanked: # If LED-off signal is not being sent... animations.animate() # Run the animations. if ble.connected: # If BLE is connected...
# at the same time, overlaid on top of each other. readingLight = Solid(pixels, color=0xFF7D13) #warm white color HEX code brightWhite = Solid(pixels, color=(150, 150, 150)) rainbow = Rainbow(pixels, speed=0.1, period=10, step=0.5) rainbowfade = RainbowFade(pixels, speed=0.4, name="rainbowfade") powerup = RainbowComet(pixels, speed=0, tail_length=50, bounce=False) off = Solid(pixels, color=BLACK) #startup animation will play just once startup = AnimateOnce(powerup) #starrynight and fire are animation groups with layered effects. starrynight = AnimationGroup( SparklePulse(pixels, speed=0.01, color=(0, 0, 150), period=1), Comet(pixels, speed=0, tail_length=8, color=(150, 150, 150), bounce=False), ) fire = AnimationGroup( Comet(pixels, speed=0, tail_length=1, color=BLACK), Sparkle(pixels, speed=0.05, num_sparkles=10, color=AMBER), Sparkle(pixels, speed=0.05, num_sparkles=10, color=RED), Sparkle(pixels, speed=0.05, num_sparkles=20, color=ORANGE), Sparkle(pixels, speed=0.05, num_sparkles=5, color=0xFF7D13), Sparkle(pixels, speed=0.05, num_sparkles=10, color=BLACK), ) # Here is the animation playlist where you set the order of modes animations = AnimationSequence( readingLight,
# Rings Only PIXEL_MAP_RINGS = PixelMap(PIXELS, [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83 ], individual_pixels=True) # LED ANIMATIONS ----------------------------------------------------------- RAINBOW = Rainbow(PIXEL_MAP_RINGS, speed=0.01, period=10, step=3) CP_RAINBOW = Rainbow(cp.pixels, speed=0.01, period=10, step=3) CRYSTAL_COMET = Comet(PIXEL_MAP_CRYSTALS, speed=SPEED, tail_length=8, color=PURPLE, bounce=True) DARK_RINGS = Solid(PIXELS, color=BLACK) DARK_CPB = Solid(cp.pixels, color=BLACK) DARK = AnimationGroup( DARK_RINGS, DARK_CPB, ) # Animations Playlist, reorder as desired. AnimationGroups play at same time ANIMATIONS = AnimationSequence( AnimationGroup( CRYSTAL_COMET, RAINBOW, CP_RAINBOW, ), auto_clear=True,
### Animation Sequences & Groups ### # Creates and organizes the animations animations = AnimationSequence( AnimationGroup( Solid(boardPixels, WHITE), ColorCycle(stripPixels, cycleSpeed, cycleColors), sync=True, ), AnimationSequence( AnimateOnce( AnimationGroup( Solid(boardPixels, WHITE), Comet(stripPixels, stripCometSpeed, cometColorA, tail_length=stripCometTailLen), ), AnimationGroup( Solid(boardPixels, WHITE), Comet(stripPixels, stripCometSpeed, cometColorB, tail_length=stripCometTailLen), ), AnimationGroup( Solid(boardPixels, WHITE), Comet(stripPixels, stripCometSpeed, cometColorC, tail_length=stripCometTailLen),
using a different board or form of NeoPixels. This example will run on SAMD21 (M0) Express boards (such as Circuit Playground Express or QT Py Haxpress), but not on SAMD21 non-Express boards (such as QT Py or Trinket). """ import time import microcontroller import board import neopixel from adafruit_led_animation.animation.comet import Comet from adafruit_led_animation.color import PURPLE # Update to match the pin connected to your NeoPixels pixel_pin = board.A3 # Update to match the number of NeoPixels you have connected pixel_num = 30 pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False) comet = Comet(pixels, speed=0.02, color=PURPLE, tail_length=10, bounce=True) while True: comet.animate() if time.monotonic() > 3600: # After an hour passes, reset the board. microcontroller.reset() # pylint: disable=no-member
start_angle=180, end_angle=360, angle_offset=0, outline=0xFF0000) circle1 = anisha.Acircle(46, 18, 13, outline=0x0000FF, angle_offset=90) group = displayio.Group(max_size=4) group.append(ellipse1) group.append(arc1) group.append(circle1) display.show(group) blink1 = Blink(arc1, speed=0.3, color=0xFF0000) blink2 = Blink(ellipse1, speed=0.7, color=0x004000) blink3 = Blink(circle1, speed=0.5, color=0x0000FF) comet1 = Comet(ellipse1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) comet2 = Comet(arc1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) comet3 = Comet(circle1, speed=0.01, color=PURPLE, tail_length=10, bounce=True) animations = AnimationSequence(AnimationGroup(blink1, blink2, blink3), AnimationGroup(comet1, comet2, comet3), advance_interval=d, auto_clear=True) time.sleep(10) while True: animations.animate()