Line 34... |
Line 34... |
34 |
"channel": 0, |
34 |
"channel": 0, |
35 |
"children": [ |
35 |
"children": [ |
36 |
{"name": "barometer", "type": "altimet01" , "channel": 0, }, |
36 |
{"name": "barometer", "type": "altimet01" , "channel": 0, }, |
37 |
{"name": "hum_temp", "type": "sht25" , "channel": 1, }, |
37 |
{"name": "hum_temp", "type": "sht25" , "channel": 1, }, |
38 |
# {"name": "wind_direction", "type": "mag01" , "channel": 1, }, |
38 |
# {"name": "wind_direction", "type": "mag01" , "channel": 1, }, |
- |
|
39 |
{"name": "thermometer", "type": "lts01" , "channel": 2, }, |
39 |
], |
40 |
], |
40 |
}, |
41 |
}, |
41 |
# {"name": "barometer2", "type": "altimet01" , "channel": 6, }, |
42 |
# {"name": "barometer2", "type": "altimet01" , "channel": 6, }, |
42 |
], |
43 |
], |
43 |
}, |
44 |
}, |
Line 47... |
Line 48... |
47 |
cfg.initialize() |
48 |
cfg.initialize() |
48 |
|
49 |
|
49 |
barometer = cfg.get_device("barometer") |
50 |
barometer = cfg.get_device("barometer") |
50 |
hum_temp = cfg.get_device("hum_temp") |
51 |
hum_temp = cfg.get_device("hum_temp") |
51 |
#wind_direction = cfg.get_device("wind_direction") |
52 |
#wind_direction = cfg.get_device("wind_direction") |
- |
|
53 |
thermometer = cfg.get_device("thermometer") |
52 |
time.sleep(0.5) |
54 |
time.sleep(0.5) |
53 |
|
55 |
|
54 |
#### Data Logging ################################################### |
56 |
#### Data Logging ################################################### |
55 |
|
57 |
|
56 |
filename = datetime.datetime.now().isoformat() |
58 |
filename = datetime.datetime.now().isoformat() |
Line 61... |
Line 63... |
61 |
while True: |
63 |
while True: |
62 |
barometer.route() |
64 |
barometer.route() |
63 |
(t1, p1) = barometer.get_tp() |
65 |
(t1, p1) = barometer.get_tp() |
64 |
hum_temp.route() |
66 |
hum_temp.route() |
65 |
t2 = hum_temp.get_temp() |
67 |
t2 = hum_temp.get_temp() |
- |
|
68 |
t3 = thermometer.get_temp() |
66 |
h1 = hum_temp.get_hum() |
69 |
h1 = hum_temp.get_hum() |
- |
|
70 |
|
67 |
|
71 |
|
68 |
sys.stdout.write(" Temperature: %.2f Pressure: %d TempSHT: %.2f HumSHT: %.1f " % (t1, p1, t2, h1,)) |
72 |
sys.stdout.write(" Temperature: %.2f Pressure: %d TempSHT: %.2f HumSHT: %.1f TempLTS: %.2f" % (t1, p1, t2, h1, t3)) |
69 |
f.write("%d\t%.2f\t%d\t%.2f\t%.1f\n" % (time.time(),t1, p1, t2, h1,)) |
73 |
f.write("%d\t%.2f\t%d\t%.2f\t%.1f\t%.2f\n" % (time.time(),t1, p1, t2, h1, t3)) |
70 |
sys.stdout.flush() |
74 |
sys.stdout.flush() |
71 |
time.sleep(10) |
75 |
time.sleep(10) |
72 |
except KeyboardInterrupt: |
76 |
except KeyboardInterrupt: |
73 |
sys.exit(0) |
77 |
sys.exit(0) |
74 |
|
78 |
|