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