We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2b763c3 + 3b1324c commit c9c07dcCopy full SHA for c9c07dc
examples/tcs34725_simpletest.py
@@ -18,8 +18,11 @@
18
r, g, b = sensor.color_rgb_bytes
19
print('Detected color: #{0:02X}{1:02X}{2:02X}'.format(r, g, b))
20
# Read the color temperature and lux of the sensor too.
21
- temp = sensor.temperature
22
- lux = sensor.lux
23
- print('Temperature: {0}K Lux: {1}'.format(temp, lux))
+ try:
+ temp = sensor.temperature
+ lux = sensor.lux
24
+ print('Temperature: {0}K Lux: {1}'.format(temp, lux))
25
+ except ZeroDivisionError:
26
+ print("No light to measure")
27
# Delay for a second and repeat.
28
time.sleep(1.0)
0 commit comments