Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions examples/tsl2561_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# Get raw (luminosity) readings using tuple unpacking
#broadband, infrared = tsl.luminosity

# Get computed lux value
# Get computed lux value (tsl.lux can return None or a float)
lux = tsl.lux

# Print results
Expand All @@ -43,7 +43,10 @@
print("Integration time = {}".format(tsl.integration_time))
print("Broadband = {}".format(broadband))
print("Infrared = {}".format(infrared))
print("Lux = {}".format(lux))
if lux is not None:
print("Lux = {}".format(lux))
else:
print("Lux value is None. Possible sensor underrange or overrange.")

# Disble the light sensor (to save power)
tsl.enabled = False