In[]:=
dev=DeviceOpen["Serial","COM3"]
Out[]=
DeviceObject
In[]:=
parseData[{val1__,44,val2__,44,val3__}]:=ToExpression@FromCharacterCode@#&/@{{val1},{val2},{val3}}parseData[___]:=Sequence[]
In[]:=
rawReadings={}
Out[]=
{}
In[]:=
task=SessionSubmit[ScheduledTask[AppendTo[rawReadings,DeviceReadBuffer[dev,"ReadTerminator"10]],{1,100},"AutoRemove"true]]
Out[]=
TaskObject
In[]:=
rawReadings
Out[]=
{{50,50,44,53,53,50,44,51,54,13},{50,50,44,53,51,44,51,54,13},{50,49,44,53,50,44,51,54,13},{50,50,44,53,50,44,51,54,13}}
In[]:=
test1=parseData/@rawReadings
Out[]=
{{22,552,36},{22,53,36},{21,52,36},{22,52,36}}
In[]:=
ListLinePlot[Transpose[parseData/@rawReadings],PlotLegendsAutomatic]//Dynamic
Out[]=
ListLinePlot,PlotLegendsAutomatic
T
rawReadings
In[]:=
DeviceClose[dev]
