Skip to content

Commit a1c2234

Browse files
authored
Merge pull request #1498 from kattni/neopixel-template
Adding NeoPixel template code.
2 parents 549f42d + 28f9348 commit a1c2234

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
CircuitPython NeoPixel Blink example - blinking the built-in NeoPixel(s).
3+
4+
Update NUMBER_OF_PIXELS to the match the number of built-in NeoPixels on the board.
5+
6+
DO NOT INCLUDE THE pylint: disable LINE IN THE GUIDE CODE. It is present only to deal with the
7+
NUMBER_OF_PIXELS variable being undefined in this pseudo-code. As you will be updating the variable
8+
in the guide, you will not need the pylint: disable.
9+
10+
For example:
11+
If you are using a QT Py, change NUMBER_OF_PIXELS to 1.
12+
If using a Neo Trinkey, change NUMBER_OF_PIXELS to 4.
13+
"""
14+
# pylint: disable=undefined-variable
15+
16+
import time
17+
import board
18+
import neopixel
19+
20+
pixel = neopixel.NeoPixel(board.NEOPIXEL, NUMBER_OF_PIXELS)
21+
22+
while True:
23+
pixel.fill((255, 0, 0))
24+
time.sleep(0.5)
25+
pixel.fill((0, 0, 0))
26+
time.sleep(0.5)

0 commit comments

Comments
 (0)