projects
/
EVA-2020-02-2.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
rename envirophatplus -> enviroplus
[EVA-2020-02-2.git]
/
examples
/
light.py
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!
10
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