Skip to content

Commit

Permalink
move gain set into try - tested with simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
standsi committed Nov 8, 2023
1 parent d733c33 commit 1954111
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions adafruit_veml7700.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ class VEML7700:

def __init__(self, i2c_bus: I2C, address: int = 0x10) -> None:
self.i2c_device = i2cdevice.I2CDevice(i2c_bus, address)
# Set lowest gain to keep from overflow on init if bright light
self.light_gain=self.ALS_GAIN_1_8
for _ in range(3):
try:
# Set lowest gain to keep from overflow on init if bright light
self.light_gain=self.ALS_GAIN_1_8
#
self.light_shutdown = False # Enable the ambient light sensor
break
except OSError:
Expand Down

0 comments on commit 1954111

Please sign in to comment.