Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using tsl.lux can produce unanticipated Exception #17

Merged
merged 3 commits into from
Dec 6, 2018
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