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