/ Halloween_Neon_Signs / Ghost.py
Ghost.py
1 # SPDX-FileCopyrightText: 2022 Noe Ruiz for Adafruit Industries 2 # SPDX-License-Identifier: MIT 3 # Ghost with Glasses Neon Sign 4 import board 5 import neopixel 6 from adafruit_led_animation.animation.blink import Blink 7 from adafruit_led_animation.animation.comet import Comet 8 from adafruit_led_animation.animation.chase import Chase 9 from adafruit_led_animation.animation.pulse import Pulse 10 from adafruit_led_animation.group import AnimationGroup 11 from adafruit_led_animation.sequence import AnimationSequence 12 from adafruit_led_animation import color 13 14 ghost_pixels = neopixel.NeoPixel(board.SDA, 90, brightness=0.5, 15 auto_write=False, pixel_order=neopixel.RGB) 16 glasses_pixels = neopixel.NeoPixel(board.SCL, 33, brightness=0.5, 17 auto_write=False, pixel_order=neopixel.RGB) 18 19 animations = AnimationSequence( 20 # Synchronized animations 21 AnimationGroup( 22 Chase(ghost_pixels,speed=0.02, color=color.CYAN, size=40, spacing=5), 23 Blink(glasses_pixels, speed=.4, color=color.PURPLE), 24 sync=False, 25 ), 26 27 # Sequential animations 28 Pulse(glasses_pixels, speed=0.01, color=color.WHITE, period=2), 29 30 # Synchronized 31 AnimationGroup( 32 Pulse(glasses_pixels, speed=0.01, color=color.PURPLE, period=1), 33 Comet(ghost_pixels, speed=0.01, color=color.CYAN, tail_length=50, bounce=False), 34 sync=True, 35 ), 36 37 advance_interval=4.0, 38 auto_clear=True, 39 auto_reset=True, 40 ) 41 42 while True: 43 animations.animate()