import serial
import numpy
import matplotlib.pyplot as plt
from drawnow import *
data = serial.Serial('com3',115200)
while True:
while (data.inWaiting() == 0):
pass
ardstr = data.readline()
print (ardstr)
Here I am trying to get data from arduino but it is coming in the format b'29.20\r\n'
. I want to have the data in the format "29.20"
so I can plot it.
I tried ardstr = str(ardstr).strip('\r\n')
and ardstr.decode('UTF-8')
but none of them is working. My python version is 3.4.3.
What can I do to get the result as "29.40"
rather than "b'29.20\r\n'"
?