フィルターのクリア

how can i create a servo object in matlab?

1 回表示 (過去 30 日間)
kwstis xoustoulakis
kwstis xoustoulakis 2015 年 9 月 13 日
コメント済み: Walter Roberson 2015 年 9 月 15 日
i want to create a servo object but i dont know how... i use r2014b edition of matlab and i want to run the commands from here http://www.mathworks.com/help/supportpkg/arduinoio/examples/control-servo-motors.html?searchHighlight=control%20servos but it doesnt work.i hv made a robotic arm and i want to send specific pulses ,so i need to create a servo object as i said. any help?? thanks

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 9 月 13 日
You need to install the support package, which can be done from R2014b onwards. See http://www.mathworks.com/help/supportpkg/arduinoio/setup-and-configuration.html
  4 件のコメント
kwstis xoustoulakis
kwstis xoustoulakis 2015 年 9 月 14 日
編集済み: Walter Roberson 2015 年 9 月 15 日
its working okay, thanks.
function [] = ServoAngle(Theta1,Theta2)
% gwnies apo 0-180;
Theta1=0:0.1:1;
Theta2=0:0.1:1;
L1=0.065;%m
L2=0.125;%m
a=arduino('COM4');
s = servo(a,9,'MinPulseDuration',7.50e-4,'MaxPulseDuration',2.4e-3);
s = servo(a,10,'MinPulseDuration',7.50e-4,'MaxPulseDuration',2.4e-3);
px=L2*cos(Theta1+Theta2) + L1*cos(Theta1)
py=L2*sin(Theta1+Theta2) + L1*sin(Theta1)
a.servoWrite(9,Theta1);
a.servoWrite(10,Theta2);
plot(px,py,'r.');
xlabel('Px','fontsize',10);
ylabel('Py','fontsize',10);
pause(1);
end
my problem now is that writeposition command accepts 0 or 1 for zero degrees and 180 respectively. Ηow can i pair degrees with 0 or 1?
i want to sending degrees from 0-180 and converting on 0-1 respectively, 0 is minimum (0) and 1 is maximum(180)
thank you!
Walter Roberson
Walter Roberson 2015 年 9 月 15 日
degrees / 180 ?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBuild Configuration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by