|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+import time, sys, signal, atexit
|
|
25
|
+import pyupm_groveo2 as upmGroveo2
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+myGroveO2 = upmGroveo2.GroveO2(0)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+def SIGINTHandler(signum, frame):
|
|
35
|
+ raise SystemExit
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+def exitHandler():
|
|
39
|
+ print "Exiting"
|
|
40
|
+ sys.exit(0)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+atexit.register(exitHandler)
|
|
44
|
+signal.signal(signal.SIGINT, SIGINTHandler)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+while(1):
|
|
48
|
+ print "The output voltage is: {0}mV".format(
|
|
49
|
+ myGroveO2.voltageValue())
|
|
50
|
+
|
|
51
|
+ time.sleep(.1)
|