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