Info

此问题已关闭。 请重新打开它进行编辑或回答。

i correctly wrote code for timer for due ?

1 次查看(过去 30 天)
Minjae Yoo
Minjae Yoo 2018-4-8
关闭: MATLAB Answer Bot 2021-8-20
Hello !
im using Due in Matlab.
with value change of writePosition fuctions.
together i want make plot in same time. so i used timer.
i correctly wrote but not work...
please help.
clc; clear all; close all; %Reset all
a=arduino('COM4','Due','Libraries','Servo'); %Set Arduinio board
ai_pin='A6'; %Set Analog pin for ADC
s = servo(a, 'D7');
tic; %Set stopwatch timer
i=0; %Set i for measure length
pause(5); %Delay 2 sec
time = str2num(get(handles.edit3,'String'));
step_input = 0.25;
writePosition(s, step_input); %1ms
pause(2);
step_input(i) = 0.79;
writePosition(s, step_input(i))
%step_input(i) = 0.79;
%writePosition(s, step_input(i)); %2ms
while (toc<999)
i=i+1;
t(i)=toc;
step_response(i)=readVoltage(a,ai_pin); %Already voltages calculated
figure(1)
plot(t,step_response,'r');
pause(0.1);
end

回答(0 个)

此问题已关闭。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by