Skip to content

Commit cdcc35c

Browse files
committed
Add/update DotStar template code.
1 parent f5dab4a commit cdcc35c

File tree

2 files changed

+26
-1
lines changed
  • CircuitPython_Templates
    • status_led_one_dotstar_rainbow
    • status_led_one_dotstar_rgb

2 files changed

+26
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: Unlicense
3+
"""
4+
CircuitPython DotStar red, green, blue, brightness control example.
5+
"""
6+
import time
7+
import board
8+
from rainbowio import colorwheel
9+
import adafruit_dotstar
10+
11+
dot = adafruit_dotstar.DotStar(board.DOTSTAR_CLOCK, board.DOTSTAR_DATA, 1)
12+
dot.brightness = 0.3
13+
14+
15+
def rainbow(delay):
16+
for color_value in range(255):
17+
for led in range(1):
18+
dot_index = (led * 256 // 1) + color_value
19+
dot[led] = colorwheel(dot_index & 255)
20+
dot.show()
21+
time.sleep(delay)
22+
23+
24+
while True:
25+
rainbow(0.02)

CircuitPython_Templates/status_led_one_dotstar_rgb/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-FileCopyrightText: 2021 Anne Barela for Adafruit Industries
22
# SPDX-License-Identifier: Unlicense
33
"""
4-
CircuitPython DotStar red, green, blue, brightness control example - single DotStar.
4+
CircuitPython DotStar red, green, blue, brightness control example.
55
"""
66
import time
77
import board

0 commit comments

Comments
 (0)