Pages: [1]   Go Down
Author Topic: sampling rate of Arduino UNO R3  (Read 1169 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody,
I am using Arduino UNO R3 in the combine with ADXL335 in order to plot real time in MATLAB 2011a. What I am getting is real time but slightly difference with stopwatch. What could be the problem? underneath is my code. This code takes 33sec for 100 data points. Has any body got suggestion to do faster operation? Would glad if I get any.

clc;
clear all;
close all;
t=0;
t1=[];
s = serial('COM3','baudrate',9600);
data = [];
j=1;
fopen(s);
for i=1:200
tic
    idn = fscanf(s);
    data1 = str2num(idn);
    data =[data; data1];
       t=toc+t;
    t1 =[t1; t];
     plot(t1,data(:,1),'m',t1,data(:,2),'c',t1,data(:,3),'b'); 
     legend('X-axis', 'Y-axis', 'Z-axis');
    axis auto;
    xlabel('Time(s)');
    ylabel('Amplitude');
    grid on;
    drawnow;
    %hold on;
end
fclose(s);
delete(s);
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 636
Posts: 34575
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Use a faster baud rate.
Logged

Pages: [1]   Go Up
Jump to: