Commit | Line | Data |
---|---|---|
0cf10e5b PH |
1 | #!/usr/bin/env python |
2 | ||
3 | import time | |
4 | import ltr559 | |
5 | ||
0cf10e5b PH |
6 | print("""light.py - Print readings from the LTR559 Light & Proximity sensor. |
7 | ||
8 | Press Ctrl+C to exit! | |
8ab4cd2d | 9 | |
0cf10e5b PH |
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 |