Mar-28-2018, 12:00 PM
ya wierd. This is what is says:
I have a query
This code below that i posted earlier:
Quote:C:\Users\Meena\AppData\Local\Programs\Python\Python36\Scripts>pip install pyserial
Requirement already satisfied: pyserial in c:\users\meena\appdata\local\programs\python\python36\lib\site-packages
I have a query
This code below that i posted earlier:
import serial import matplotlib.pyplot as ply import numpy #used for mathematical operations import pylab as py from mpl_toolkits.mplot3d import Axes3D from drawnow import * ACCX=[] ACCY=[] ACCZ=[] GYRX=[] GYRY=[] GYRZ=[] arduinodata=serial.Serial('COM3',9600) #port name and baud rate fig = ply.figure() ax = Axes3D(fig) ply.ion() def makeplotting(): ply.subplot(611) ply.ylabel('ACCX (°/sec)') ply.xlabel('Time') ply.plot(ACCX) ply.subplot(612) ply.ylabel('ACCY (°/sec)') ply.xlabel('Time') ply.plot(ACCY) ply.subplot(613) ply.ylabel('ACCZ (°/sec)') ply.xlabel('Time') ply.plot(ACCZ) while True: while(arduinodata.inWaiting()==0): pass arduinostring=arduinodata.readline() arduinostring=str(arduinostring,encoding="utf-8") dataArray=arduinostring.split(',') print (dataArray) if (len(dataArray)==3): if (type(float(dataArray[0]))is float): accxtemp=float(dataArray[0]) ACCX.append(accxtemp) print (accxtemp) else: print ('Data is not in float and hence marked to zero') dataArray[0]=0.0 accxtemp=float(dataArray[0]) ACCX.append(accxtemp) print (accxtemp) if (type(float(dataArray[1]))is float): accytemp=float(dataArray[1]) ACCY.append(accytemp) print (accytemp) else: print ('Data is not in float and hence marked to zero') dataArray[1]=0.0 accytemp=float(dataArray[1]) ACCY.append(accytemp) print (accytemp) if (type(float(dataArray[2]))is float): accztemp=float(dataArray[2]) ACCZ.append(accztemp) print (accztemp) else: print ('Data is not in float and hence marked to zero') dataArray[2]=0.0 accztemp=float(dataArray[2]) ACCZ.append(accztemp) print (accztemp) drawnow(makeplotting) else: print ('there is some data missing')why do you think this is not working?