Rank: 106708 based on 0 downloads (last 30 days) and 0 file submitted
photo

Tee

E-mail
Company/University
UKM

Personal Profile:

Mechanical engineering student

Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Tee
Updated File Comments Rating
06 Apr 2011 Arduino IO package: Slides and Examples Slides for the webinar: "Learning Basic Mechatronics Concepts Using the Arduino Board and MATLAB". Author: Giampiero Campa

I have some question on obtain data from arduino which connect to optical encoder. I have using following code to obtain data from Arduino

function encoder1pushbutton9_Callback(hObject, eventdata, handles)
handles.a.pinMode(2,'input');
handles.a.digitalRead(2)
numberOfDatas = 200;
data = zeros(1, numberOfDatas);
i = 1;
% Main graph figure
figure(1);
hold on;
title('Incomming Data from External Device');
xlabel('Data Number');
ylabel(' output (0-1)');
for i=1:numberOfDatas
% Get the data from the serial object
data(i) = handles.a.digitalRead(2);
% Plot the data
figure(1);
plot(i, data(i), 'm*');
drawnow;
end
Did i have to set the Baudrate, databits and stopbits to acquire data from arduino???

Contact us