Matlab GUI

조회 수: 5(최근 30일)
Tee 2011년 4월 6일
댓글: Brayan Reyes 2017년 11월 21일
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)
numberOfDatas = 200;
data = zeros(1, numberOfDatas);
i = 1;
% Main graph figure
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
plot(i, data(i), 'm*');
Did i have to set the Baudrate, databits and stopbits to acquire data from arduino???


Walter Roberson
Walter Roberson 2011년 4월 6일
Everyone else that I have seen discussing the Arduino has been using the serial port to do the reading, not digital I/O. How exactly is your Arduino connected to the system you are running Matlab on?
  댓글 수: 3
Tee 2011년 4월 6일
Another question, the code i write only collect data ,for example 200 data,got any code can i write to know how many data transfer in 1 second?

댓글을 달려면 로그인하십시오.

Tee 2011년 4월 6일
I using digital I/O to control my motor through Matlab GUI, therefore i using digital I/O to acquire data from Arduino
  댓글 수: 1
Brayan Reyes
Brayan Reyes 2017년 11월 21일
How was it?

댓글을 달려면 로그인하십시오.


Find more on Instrument Control Toolbox in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by