Ejemplo n.º 1
0
def connect_device():
    global ad7799, btn_text

    if ad7799 is None:
        ad7799 = adi.ad7799(uri="serial:"+comport.get()+",115200")

    btn_text.set("Connected!!!")
    new_record.append('x - Tracking | Non-tracking')
    new_record.append('x - samples to retain')

if new_session == 1:
    print("\n-Connection setup-\n")
while True:
    if new_session == 1 or retry == 5:
        port = input(
            'Input Serial line (e.g. if ADICUP3029 is connected to COM7, input \'COM7\' )\nSerial line: '
        )
    else:
        port = rec_value[9]
        retry = retry + 1
    try:
        context = "serial:" + port + ",115200"
        ad7799 = adi.ad7799(uri=context)
        input(
            "\nCN0548 board detected.\nPress 'enter' key to start board operation\n"
        )
        break
    except:
        print("Port not found\n")
new_record.append(port + ' - machine-defined')
print(
    "Voltage readings are in volts (V) while current readings are in milliamperes (mA)."
)

# ---- Record session config -----

if new_session == 1:
    record = open("session_record.txt", "w")