Advertisement
Guest User

Untitled

a guest
Aug 15th, 2022
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.59 KB | Software | 0 0
  1. import board
  2. import neopixel
  3. import time
  4. from adafruit_led_animation.animation.blink import Blink
  5. from adafruit_led_animation.animation.comet import Comet
  6. from adafruit_led_animation.animation.chase import Chase
  7. from adafruit_led_animation.animation.pulse import Pulse
  8. from adafruit_led_animation.sequence import AnimationSequence
  9. from adafruit_led_animation.color import PURPLE, AMBER, JADE, CYAN, TEAL
  10. from adafruit_led_animation.group import AnimationGroup
  11. from adafruit_led_animation import color
  12. from adafruit_led_animation.animation.sparkle import Sparkle
  13. from adafruit_led_animation import helper
  14. from adafruit_led_animation.helper import PixelMap
  15.  
  16. # 206 Neopixels(103 on 2 different pins)
  17. pixel_pin = board.A4
  18. pixel_pinL = board.A2
  19. # Update to match the number of NeoPixels you have connected
  20. pixel_num = 144
  21. pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False,  pixel_order=(1, 0, 2, 3))
  22. pixil = neopixel.NeoPixel(pixel_pinL, pixel_num, brightness=0.5, auto_write=False,  pixel_order=(1, 0, 2, 3))
  23.  
  24. leds_range0 = PixelMap(pixels, range(0,16), individual_pixels=True) #0 to J-shape
  25. leds_range1 = PixelMap(pixil, range(0,17), individual_pixels=True)
  26. leds_sidecresL1 = PixelMap(pixil, range(17,23), individual_pixels=True)
  27. leds_sidecresR1 = PixelMap(pixels, range(17,22), individual_pixels=True)
  28. leds_sidecresL2 = PixelMap(pixil, range(24,29), individual_pixels=True)
  29. leds_sidecresR2 = PixelMap(pixels, range(23,29), individual_pixels=True)
  30. leds_R_0 = PixelMap(pixil, range(70,85), individual_pixels=True)
  31. leds_R_1 = PixelMap(pixels, range(2,10), individual_pixels=True)
  32.  
  33. leds_stemL1 = PixelMap(pixil, [30, 31, 32, 33, 34, 35], individual_pixels=True) #18 to 23 crescent right (1)
  34. leds_stemL2 = PixelMap(pixil, range(56,70), individual_pixels=True) #24 to 29 crescent right (2)
  35. #leds_stemL3 = PixelMap(pixil, range(45,85), individual_pixels=True)  #18 to 22 crescent left (1)
  36. #leds_stemR1 = PixelMap(pixels, range(30,37), individual_pixels=True) #23 to 27 crescent left (2)
  37. #leds_stemR2 = PixelMap(pixels, range(38,44), individual_pixels=True)
  38. #leds_stemR3 = PixelMap(pixels, range(45,65), individual_pixels=True)
  39.  
  40.  
  41. animations = AnimationSequence(
  42. AnimationGroup(
  43. Comet(leds_range0, speed=0.04, tail_length=15, color=TEAL),
  44. Comet(leds_range1, speed=0.04, tail_length=15, color=TEAL),
  45. Comet(leds_sidecresL1, speed=0.04, tail_length=10, color=TEAL, reverse=True),
  46. Comet(leds_sidecresR1, speed=0.04, tail_length=10, color=TEAL, reverse=True),
  47. Comet(leds_sidecresL2, speed=0.04, tail_length=10, color=TEAL),
  48. Comet(leds_sidecresR2, speed=0.04, tail_length=10, color=TEAL, reverse=True),
  49. Comet(leds_stemL1, speed=0.04, tail_length=10, color=TEAL),
  50. Comet(leds_stemL2, speed=0.04, tail_length=10, color=TEAL),
  51. #After this point code completely stops responding, even passing higher up digits in the strip to a new line
  52. #the code is not being passed on and nothing lights up.
  53. #Comet(leds_R_0, speed=0.04, tail_length=2, color=TEAL),
  54. #Comet(leds_R_1, speed=0.04, tail_length=2, color=TEAL),
  55. #Comet(leds_stemL3, speed=0.04, tail_length=10, color=TEAL),
  56. #Comet(leds_stemR1, speed=0.04, tail_length=10, color=TEAL),
  57. #Comet(leds_stemR2, speed=0.04, tail_length=10, color=TEAL),
  58. #Comet(leds_stemR3, speed=0.04, tail_length=10, color=TEAL),
  59.  
  60.  
  61. #sync=True,
  62.  
  63. ),
  64. AnimationGroup(
  65. Comet(pixels, speed=0.08, color=CYAN),
  66. Comet(pixil, speed=0.08, color=CYAN),
  67.  
  68.  
  69. #sync=True,
  70. Sparkle(pixels, speed=0.08, color=TEAL, num_sparkles=10),
  71.  
  72. Sparkle(pixil, speed=0.08, color=CYAN, num_sparkles=10)
  73. ),
  74.  
  75.  
  76. advance_interval=8.0,
  77. auto_clear=True,
  78. auto_reset=True,
  79. )
  80. while True:
  81.  
  82.  animations.animate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement