Skip to content

Commit 92182ea

Browse files
authored
Merge pull request adafruit#53 from brentru/expose-rgbled-status-wifimanager
Add RGB Status LED to WiFiManager
2 parents 46b4dea + aeae91e commit 92182ea

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

adafruit_esp32spi/adafruit_esp32spi_wifimanager.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ def __init__(self, esp, secrets, status_pixel=None, attempts=2):
4242
"""
4343
:param ESP_SPIcontrol esp: The ESP object we are using
4444
:param dict secrets: The WiFi and Adafruit IO secrets dict (See examples)
45-
:param status_pixel: (Optional) The pixel device - A NeoPixel or DotStar (default=None)
46-
:type status_pixel: NeoPixel or DotStar
45+
:param status_pixel: (Optional) The pixel device - A NeoPixel, DotStar,
46+
or RGB LED (default=None)
47+
:type status_pixel: NeoPixel, DotStar, or RGB LED
4748
:param int attempts: (Optional) Failed attempts before resetting the ESP32 (default=2)
4849
"""
4950
# Read the settings
@@ -214,13 +215,16 @@ def ip_address(self):
214215

215216
def pixel_status(self, value):
216217
"""
217-
Change Status NeoPixel if it was defined
218+
Change Status Pixel if it was defined
218219
219220
:param value: The value to set the Board's status LED to
220221
:type value: int or 3-value tuple
221222
"""
222223
if self.statuspix:
223-
self.statuspix.fill(value)
224+
if hasattr(self.statuspix, 'color'):
225+
self.statuspix.color = value
226+
else:
227+
self.statuspix.fill(value)
224228

225229
def signal_strength(self):
226230
"""

examples/esp32spi_aio_post.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030
"""Use below for Most Boards"""
3131
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards
3232
"""Uncomment below for ItsyBitsy M4"""
33-
#status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
33+
# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
34+
# Uncomment below for an externally defined RGB LED
35+
# import adafruit_rgbled
36+
# from adafruit_esp32spi import PWMOut
37+
# RED_LED = PWMOut.PWMOut(esp, 26)
38+
# GREEN_LED = PWMOut.PWMOut(esp, 27)
39+
# BLUE_LED = PWMOut.PWMOut(esp, 25)
40+
# status_light = adafruit_rgbled.RGBLED(RED_LED, BLUE_LED, GREEN_LED)
3441
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
3542

3643
counter = 0

0 commit comments

Comments
 (0)