Skip to content

Commit f2e9306

Browse files
committed
Add LED control to as7341 sensor wrapper class
1 parent 3d45417 commit f2e9306

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/public_mqtt_sdl_demo/lib/as7341_sensor.py

+17
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,23 @@ def all_channels_clr_nir(self):
131131
def disable(self):
132132
self.sensor.disable()
133133

134+
# LED control
135+
136+
@property
137+
def LED(self):
138+
"""Get the current state of the onboard LED."""
139+
return self._led_state
140+
141+
@LED.setter
142+
def LED(self, state):
143+
"""Set the LED state."""
144+
if state:
145+
self.sensor.set_led_current(4) # Use the imported set_led_current method
146+
self._led_state = True
147+
else:
148+
self.sensor.set_led_current(0)
149+
self._led_state = False
150+
134151

135152
# %% Code Graveyard
136153
# gain_to_code_lookup = {

0 commit comments

Comments
 (0)