Skip to content

Commit

Permalink
Merge pull request #257 from Neil-YL/my-feature
Browse files Browse the repository at this point in the history
Add LED control to as7341 sensor wrapper class
  • Loading branch information
sgbaird authored Dec 6, 2024
2 parents 3d45417 + f2e9306 commit 59a2dd5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/public_mqtt_sdl_demo/lib/as7341_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,23 @@ def all_channels_clr_nir(self):
def disable(self):
self.sensor.disable()

# LED control

@property
def LED(self):
"""Get the current state of the onboard LED."""
return self._led_state

@LED.setter
def LED(self, state):
"""Set the LED state."""
if state:
self.sensor.set_led_current(4) # Use the imported set_led_current method
self._led_state = True
else:
self.sensor.set_led_current(0)
self._led_state = False


# %% Code Graveyard
# gain_to_code_lookup = {
Expand Down

0 comments on commit 59a2dd5

Please sign in to comment.