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
9 changes: 6 additions & 3 deletions examples/tcs34725_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
r, g, b = sensor.color_rgb_bytes
print('Detected color: #{0:02X}{1:02X}{2:02X}'.format(r, g, b))
# Read the color temperature and lux of the sensor too.
temp = sensor.temperature
lux = sensor.lux
print('Temperature: {0}K Lux: {1}'.format(temp, lux))
try:
temp = sensor.temperature
lux = sensor.lux
print('Temperature: {0}K Lux: {1}'.format(temp, lux))
except ZeroDivisionError:
print("No light to measure")
# Delay for a second and repeat.
time.sleep(1.0)