-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcalibrate.py
39 lines (37 loc) · 1.2 KB
/
calibrate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import time
from aq import AQ
aq = AQ()
print("Calibrate sensor")
print("================")
print("Only for Air Quaility for Raspbewrry Pi boards of version 1e and later")
while True:
print("Options")
print("1. Show eCO2 reading")
print("2. Calibrate to 400 ppm")
print("3. Reset to factory default")
print("4. Quit")
option = input(">")
if (option == '1') :
print("Current eCO2 reading: " + str(aq.get_eco2()))
if (option == '2') :
print("Your sensor should be in an environment with around 400ppm CO2 (fresh air)")
confirm = input("Calibrate? (Y/N)")
if (confirm == 'Y' or confirm == 'y'):
aq.calibrate_400()
time.sleep(2)
print('Sensor calibrated')
else:
print('Cancelled calibration')
elif (option == '3') :
confirm = input("Reset calibration to factory default? (Y/N)")
if (confirm == 'Y' or confirm == 'y'):
aq.reset_calibration()
time.sleep(2)
print('Sensor set to factory default')
else:
print('Cancelled calibration')
elif (option == '4') :
print("Bye")
break
else:
print('unknown option')