How to Plot Real time data in udoo neo?

Discussion in 'UDOO NEO' started by George Nick, May 24, 2017.

  1. George Nick

    George Nick New Member

    Joined:
    May 12, 2017
    Messages:
    2
    Likes Received:
    0
    hi everyone, i just work on my ecg project. buat i'm stuck in plotting the real time data from udoo. Can anyone help me find some code for plot the real time code in python?
    i just try some this code but it didnt work well

    import serial
    import time
    import matplotlib.pyplot as plt
    import numpy as np

    ubaudrate = 9600
    uport = '/dev/ttyMCC' # set the correct port before run it
    userial = serial.Serial(uport, ubaudrate, timeout=1)
    userial.timeout = 10
    if userial.isOpen():
    while True:
    size = userial.inWaiting()
    if size:
    data = np.float64(np.frombuffer(data.encode(), 'B'))
    plt.figure
    plt.plot(data, 'b', alpha=0.75)
    plt.legend(('Sinyal Jantung'), loc='best')
    plt.grid(True)
    plt.show()

    #print data
    else:
    print ('no data')
    time.sleep(1)
    else:
    print ('serial not open')
    # z1serial.close() # close z1serial if z1serial is open.

    thanks for your help
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580

Share This Page