Skip to content

Commit dc86934

Browse files
authored
Merge pull request adafruit#1227 from adafruit/neopixel-gemma-torch
neopixel gemma torch code
2 parents 8e6928b + 7531855 commit dc86934

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

NeoPixel_Gemma_Torch/code.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import board
2+
import neopixel
3+
import adafruit_dotstar
4+
5+
LED = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1) #Setup Internal Dotar
6+
LED.brightness = 0.8 #DotStar brightness
7+
8+
NUMPIX = 7 # Number of NeoPixels
9+
PIXPIN = board.D2 # Pin where NeoPixels are connected
10+
PIXELS = neopixel.NeoPixel(PIXPIN, NUMPIX) # NeoPixel object setup
11+
12+
RED = 7 #Number of pixels to be red
13+
BLUE = 0 #First pixel
14+
15+
while True: # Loop forever...
16+
#Make the internal dotstar light up.
17+
LED[0] = (100, 0, 255)
18+
19+
#Select these pixels starting with the second pixel.
20+
for i in range(1, RED):
21+
# Make the pixels red
22+
PIXELS[i] = (100, 0, 0)
23+
24+
#Make the first neopixel this color
25+
PIXELS[BLUE] = (0, 0, 100)

0 commit comments

Comments
 (0)