real time - 3 sensor reading from arduino to matlab serially -



real time - 3 sensor reading from arduino to matlab serially -

i taking 3 input sensor values arduino. code arduino is

unsigned int pres; unsigned int temp; unsigned int fluidrate; void setup() { serial.begin(9600); } void loop() { pres = analogread(0); temp = analogread(1); fluidrate = analogread(2); serial.println(pres); serial.println(temp); serial.println(fluidrate); }

i want plot these values in 3 different axes created in matlab guide.these plot should in real time.how can sensor info separately. code single info plot

obj = serial('com8'); %creating object set(obj,'baudrate',9600) %setting baudrate fopen(obj); %open port set(obj,'terminator','cr') %providing terminator pressure1=0; % variable y axis time1=now; % time in x axis % create graphics object particular axes handles.hplot1 = plot(handles.axes1, nan, nan); guidata(hobject, handles); while 2>1 % infinite loop time2=now; x=[time1 time2]; ip_data = fscanf(obj) ; pressure2= str2num(ip_data) ; pressure=[pressure1 pressure2]; datetick('x','hh:mm') %change axis pause(0.5); pressure1=pressure2; time1=time2; end end

please help me!

arduino real-time matlab-guide

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -