Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

i correctly wrote code for timer for due ?

1 visualizzazione (ultimi 30 giorni)
Minjae Yoo
Minjae Yoo il 8 Apr 2018
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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

Risposte (0)

Questa domanda è chiusa.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by