We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 986ccdf + 0477930 commit 9535c8eCopy full SHA for 9535c8e
examples/tsl2561_simpletest.py
@@ -34,7 +34,7 @@
34
# Get raw (luminosity) readings using tuple unpacking
35
#broadband, infrared = tsl.luminosity
36
37
-# Get computed lux value
+# Get computed lux value (tsl.lux can return None or a float)
38
lux = tsl.lux
39
40
# Print results
@@ -43,7 +43,10 @@
43
print("Integration time = {}".format(tsl.integration_time))
44
print("Broadband = {}".format(broadband))
45
print("Infrared = {}".format(infrared))
46
-print("Lux = {}".format(lux))
+if lux is not None:
47
+ print("Lux = {}".format(lux))
48
+else:
49
+ print("Lux value is None. Possible sensor underrange or overrange.")
50
51
# Disble the light sensor (to save power)
52
tsl.enabled = False
0 commit comments