-
Notifications
You must be signed in to change notification settings - Fork 2
/
fuelcell_reader.py
66 lines (49 loc) · 1.69 KB
/
fuelcell_reader.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
##############################################################
# #
# P R O J E K T A V A L O N #
# #
# #
# Script to read the values from the fuelcell #
# #
# (c) Stefan Wismer - [email protected] #
# #
##############################################################
# Importing generic things
import ddxInterface
import serial
# And the Driver Class
import fuelcell
# Debug level: 0 is nothing, more is more (max: 3)
debug = 2
# FuelCell handler
sfc = fuelcell.FuelCell(debug)
# Global Stuff
msg = 'something that is not null'
msg_suc = False
if debug > 0:
print "\n"
print "PROJECT AVALON - Fuel Cell Values Reading Script"
print "================================================\n\n"
print "Fuel Cell script is running... Debug Mode is ON\n"
# Open Store
if debug > 0:
print "Trying to Open DDX-Store..."
try:
store = ddxInterface.ddxStore()
except:
print "\n\n\nFailed to Connect to the DDX Store. Exiting..."
exit()
else:
if debug > 0:
print "Sucessful.\n"
# Open a serial connection to the fuel cell...
sfc.serial_open("/dev/ttyUSB6",9600)
# Sending a linefeed to the fuel cell to wake it up
if debug > 0:
print "Saying hello to the fuelcell..."
sfc.reset()
# Reading the values from the Fuel cell
sfc.get_values()
# TODO: Bring values to the store...
if debug > 0:
print "Script ended."