-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathOEM_PH_example.py
More file actions
21 lines (17 loc) · 915 Bytes
/
OEM_PH_example.py
File metadata and controls
21 lines (17 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from AtlasOEM_PH import AtlasOEM_PH
import time
def main():
PH = AtlasOEM_PH() # create an OEM PH object
PH.write_active_hibernate(1) # tell the circuit to start taking readings
while True:
if PH.read_new_reading_available(): # if we have a new reading
pH_reading = PH.read_PH_reading() # get it from the circuit
print("OEM pH reading: " + str(pH_reading)) # print the reading
PH.write_new_reading_available(0) # then clear the new reading register
# so the circuit can set the register
# high again when it acquires a new reading
else:
#print("waiting")
time.sleep(.5) #if theres no reading, wait some time to not poll excessively
if __name__ == '__main__':
main()