Beispiel #1
0
	Values and header info is are hardcoded here and in ConsoleInterface declaration, respectively.

"""

from table import Table
from interface import ConsoleInterface

data = Table('data')

time = ['19:00:32', '19:00:32', '19:00:33', '19:00:34']
temp = ['23.0', '23.0', '23.0', '23.0']
fbar = ['0.0', '12.0', '87.2', '0.0']
ilux = ['60.1', '69.1', '62.1', '62.1']

console = ConsoleInterface(data)  # binds data table to interface object
console.init_interface()  # prints header


def build_rows(ptime, ptemp, pfbar, pilux):
    rows = []
    if len(ptime) == len(ptemp) == len(pfbar) == len(pilux):
        for x, val in enumerate(ptime):
            rows.append([ptime[x], ptemp[x], pfbar[x], pilux[x]])
    else:
        print 'ERROR: Data values not the same lenght.'

    return rows


data.add_rows(build_rows(time, temp, fbar, ilux))
Beispiel #2
0
    #lint_values = [float(y) for y in m_lint]

    row = [str(m_time), m_temp, m_fbar, m_lint]  #data are float values

    return row


#### Code itself ####

# Objects declaration
ard = SerialArduino(port, baud_rate)
txt = FileHandler(user_file)
dat = Table('data')
cli = ConsoleInterface(dat)  # binds data table to interface object

cli.init_interface()  # prints header
op = cli.start_menu()

if op.upper() == 'Y':
    #cli.setup_interface()
    user_file = raw_input('Type TXT file name: ')
    txt.set_name(user_file)

    cli.show_warning('Hit Ctrl-C to stop acquisition')
    cli.getch()

    ### !!! BIG INCONSISTENCY RIGHT HERE !!!

    ard.write('C0')  # stops Arduino just in case
    ard.write(
        'C1')  # C1 is the command to start C = cmd, 1 sets Arduino 'flag' to 1
Beispiel #3
0
    # lint_values = [float(y) for y in m_lint]

    row = [str(m_time), m_temp, m_fbar, m_lint]  # data are float values

    return row


#### Code itself ####

# Objects declaration
ard = SerialArduino(port, baud_rate)
txt = FileHandler(user_file)
dat = Table("data")
cli = ConsoleInterface(dat)  # binds data table to interface object

cli.init_interface()  # prints header
op = cli.start_menu()

if op.upper() == "Y":
    # cli.setup_interface()
    user_file = raw_input("Type TXT file name: ")
    txt.set_name(user_file)

    cli.show_warning("Hit Ctrl-C to stop acquisition")
    cli.getch()

    ### !!! BIG INCONSISTENCY RIGHT HERE !!!

    ard.write("C0")  # stops Arduino just in case
    ard.write("C1")  # C1 is the command to start C = cmd, 1 sets Arduino 'flag' to 1
    msg = ard.read()
Beispiel #4
0
	Values and header info is are hardcoded here and in ConsoleInterface declaration, respectively.

"""

from table import Table
from interface import ConsoleInterface

data = Table("data")

time = ["19:00:32", "19:00:32", "19:00:33", "19:00:34"]
temp = ["23.0", "23.0", "23.0", "23.0"]
fbar = ["0.0", "12.0", "87.2", "0.0"]
ilux = ["60.1", "69.1", "62.1", "62.1"]

console = ConsoleInterface(data)  # binds data table to interface object
console.init_interface()  # prints header


def build_rows(ptime, ptemp, pfbar, pilux):
    rows = []
    if len(ptime) == len(ptemp) == len(pfbar) == len(pilux):
        for x, val in enumerate(ptime):
            rows.append([ptime[x], ptemp[x], pfbar[x], pilux[x]])
    else:
        print "ERROR: Data values not the same lenght."

    return rows


data.add_rows(build_rows(time, temp, fbar, ilux))