Skip to content

Commit 0592a3f

Browse files
authored
Add files via upload
1 parent 4ac15b2 commit 0592a3f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Gemma/NeoPixel_Gemma_Torch/code.py

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

0 commit comments

Comments
 (0)