Skip to content

Commit 0cf10e5

Browse files
committed
Added examples
1 parent 82b86ca commit 0cf10e5

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

examples/gas.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
3+
import time
4+
from envirophatplus import gas
5+
6+
7+
print("""gas.py - Print readings from the MICS6812 Gas sensor.
8+
9+
Press Ctrl+C to exit!
10+
11+
""")
12+
13+
try:
14+
while True:
15+
readings = gas.read_all()
16+
print(readings)
17+
time.sleep(1.0)
18+
except KeyboardInterrupt:
19+
pass

examples/light.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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

examples/particles.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
3+
import time
4+
from pms5003 import PMS5003
5+
6+
7+
print("""particles.py - Print readings from the PM5003 Particle sensor.
8+
9+
Press Ctrl+C to exit!
10+
11+
""")
12+
13+
pms5003 = PMS5003()
14+
time.sleep(1.0)
15+
16+
17+
try:
18+
while True:
19+
readings = pms5003.read()
20+
print(readings)
21+
time.sleep(1.0)
22+
except KeyboardInterrupt:
23+
pass

0 commit comments

Comments
 (0)