def insert_hr_data(number): try: # set up the serial line # set up serial port # set up timeout #poner my puerto de arduino en la siguiente linea. Ej: COM2 ser = serial.Serial('/dev/cu.usbmodem14101', 9600, timeout=2) #show the dataf while True: #get data from serial port: data = (str(ser.readline().decode("utf-8"))).strip() if data: print(data) db.insert_hr(number, data) except Exception as e: print(e)
def insert_hr_data(number): try: # set up the serial line # set up serial port # set up timeout ser = serial.Serial('/dev/cu.usbmodem1412401',9600, timeout = 2) #show the dataf while True: #get data from serial port: data = (str(ser.readline().decode("utf-8"))).strip() if data: print(data) db.insert_hr(number,data) except Exception as e: print(e) print("El dispositivo no esta conectado -> ")
def insert_hr_data(number): try: # set up the serial line # set up serial port # set up timeout ser = serial.Serial('/dev/ttyS3',9600, timeout = 2) #show the data #get data from serial port: while True: data = (str(ser.readline().decode("utf-8"))).strip() if data: print(data) #print(len(data)) db.insert_hr(number,data) except Exception as ex: print(ex)
def insert_hr_data(number): try: # set up the serial line # set up serial port # set up timeout ser = serial.Serial('/dev/cu.usbmodemFD111',9600, timeout = 2) #show the dataf while True: #get data from serial port: try: data = int(ser.readline().decode("utf-8")) if data: print(data) db.insert_hr(number,data) except ValueError: pass except Exception as e: print(e) print("·El dispositivo no esta conectado· -> ")