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.
1 parent 2b763c3 commit 2123490Copy full SHA for 2123490
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
+ try:
+ temp = sensor.temperature
23
+ lux = sensor.lux
24
+ except ZeroDivisionError:
25
+ print("No light to measure")
26
print('Temperature: {0}K Lux: {1}'.format(temp, lux))
27
# Delay for a second and repeat.
28
time.sleep(1.0)
0 commit comments