Skip to content

Commit 907dbfc

Browse files
authored
initial commit
1 parent a50047b commit 907dbfc

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

CLUE_Purse_Slideshow/code.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Bright Wearables Purse Slideshow with FancyLED
2+
# Anne Barela for Adafruit Industries, February 2020
3+
# MIT License
4+
5+
import time
6+
import board
7+
import adafruit_dotstar as dotstar
8+
from adafruit_clue import clue
9+
from adafruit_slideshow import SlideShow, PlayBackDirection
10+
import adafruit_fancyled.adafruit_fancyled as fancy
11+
12+
slideshow = SlideShow(clue.display, None, folder="/",
13+
auto_advance=False, dwell=0)
14+
15+
# For the Bright Wearables DotStar LED Ring
16+
num_leds = 12
17+
palette = [fancy.CRGB(1.0, 0.0, 0.5), # Pink
18+
fancy.CRGB(0.0, 1.0, 0.0), # Green
19+
fancy.CRGB(0.0, 0.0, 1.0)] # Blue
20+
pixels = dotstar.DotStar(board.P13, board.P15, num_leds, brightness=0.5,
21+
auto_write=False)
22+
offset = 0 # Initialize the offset
23+
24+
while True:
25+
if clue.button_b:
26+
slideshow.direction = PlayBackDirection.FORWARD
27+
slideshow.advance()
28+
if clue.button_a:
29+
slideshow.direction = PlayBackDirection.BACKWARD
30+
slideshow.advance()
31+
for i in range(num_leds):
32+
# Load each pixel's color from the palette using an offset, run it
33+
# through the gamma function, pack RGB value and assign to pixel.
34+
color = fancy.palette_lookup(palette, offset + i / num_leds)
35+
color = fancy.gamma_adjust(color, brightness=0.25)
36+
pixels[i] = color.pack()
37+
pixels.show()
38+
offset = offset + 1
39+
if offset > 12:
40+
offset = 0
41+
time.sleep(0.1)

0 commit comments

Comments
 (0)