code.py
 1  # SPDX-FileCopyrightText: 2017 Leslie Birch for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  # Jewel Hairstick by Leslie Birch for Adafruit Industries
 6  # Based on NeoPixel Library by Adafruit
 7  
 8  import time
 9  
10  import board
11  import neopixel
12  from digitalio import DigitalInOut, Direction
13  
14  pixpin = board.D1
15  numpix = 7
16  
17  led = DigitalInOut(board.D13)
18  led.direction = Direction.OUTPUT
19  
20  # defaults to RGB|GRB Neopixels
21  strip = neopixel.NeoPixel(pixpin, numpix, brightness=.1, auto_write=True)
22  # uncomment the following two lines for RGBW Neopixels
23  # strip = neopixel.NeoPixel(
24  #   pixpin, numpix, bpp=4, brightness=.3, auto_write=True)
25  
26  # You can have fun here changing the colors for the code
27  color1 = (236, 79, 100)  # Salmon Pink
28  color2 = (246, 216, 180)  # Cream
29  color3 = (174, 113, 208)  # Lavendar
30  color4 = (182, 31, 40)  # Red
31  color5 = (91, 44, 86)  # Purple
32  
33  while True:
34      # the first number is the pixel number for Jewel. O is the center one
35      strip[1] = color1
36      strip[2] = color1
37      strip[3] = color1
38      strip[4] = color1
39      strip[5] = color1
40      strip[6] = color1
41      strip[0] = color2
42      time.sleep(3)
43  
44      strip[1] = color2
45      strip[2] = color2
46      strip[3] = color2
47      strip[4] = color2
48      strip[5] = color2
49      strip[6] = color2
50      strip[0] = color3
51      time.sleep(3)
52  
53      strip[1] = color3
54      strip[2] = color3
55      strip[3] = color3
56      strip[4] = color3
57      strip[5] = color3
58      strip[6] = color3
59      strip[0] = color4
60      time.sleep(3)
61  
62      strip[1] = color4
63      strip[2] = color4
64      strip[3] = color4
65      strip[4] = color4
66      strip[5] = color4
67      strip[6] = color4
68      strip[0] = color5
69      time.sleep(3)