Skip to content

Commit 60431b8

Browse files
committed
having neopixels turn on on boot
Updating code to have NeoPixels turn on on boot for wiring check
1 parent 7b5029c commit 60431b8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Star_Fragment_Lamp/code.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
# longitude
2020
long = -71.06
2121

22+
# neopixel setup
23+
NUMPIXELS = 30 # number of neopixels
24+
BRIGHTNESS = 0.5 # A number between 0.0 and 1.0, where 0.0 is off, and 1.0 is max.
25+
PIN = board.A3 # This is the default pin on the NeoPixel Driver BFF.
26+
27+
pixels = neopixel.NeoPixel(PIN, NUMPIXELS, brightness=BRIGHTNESS, auto_write=False)
28+
29+
# turn on NeoPixels on boot to check wiring
30+
pixels.fill((255, 125, 0))
31+
pixels.show()
32+
2233
# API request to open-meteo
2334
weather_url = "https://api.open-meteo.com/v1/forecast?"
2435
# pass latitude and longitude
@@ -136,13 +147,6 @@ def sun_countdown(sun_event):
136147
percent_red = 0
137148
percent_yellow = 0
138149

139-
# neopixel setup
140-
NUMPIXELS = 30 # number of neopixels
141-
BRIGHTNESS = 0.05 # A number between 0.0 and 1.0, where 0.0 is off, and 1.0 is max.
142-
PIN = board.A3 # This is the default pin on the NeoPixel Driver BFF.
143-
144-
pixels = neopixel.NeoPixel(PIN, NUMPIXELS, brightness=BRIGHTNESS, auto_write=False)
145-
146150
print(total_until_set)
147151
# check to see if the star fragment should be lit up on start-up
148152
if total_until_set < 0:

0 commit comments

Comments
 (0)