216477a766db19768e9d92683f7984bc664f3fac
[EVA-2020-02-2.git] / examples / light.py
1 #!/usr/bin/env python
2
3 import time
4 import ltr559
5
6 print("""light.py - Print readings from the LTR559 Light & Proximity sensor.
7
8 Press Ctrl+C to exit!
9
10 """)
11
12 try:
13 while True:
14 lux = ltr559.get_lux()
15 prox = ltr559.get_proximity()
16 print("""Light: {:05.02f} Lux
17 Proximity: {:05.02f}
18 """.format(lux, prox))
19 time.sleep(1.0)
20 except KeyboardInterrupt:
21 pass