simple program to run a servo motor using matlab-arduino uno.

7 ビュー (過去 30 日間)
vishnu andavar
vishnu andavar 2013 年 4 月 10 日
回答済み: Bhuvnesh Rathor 2020 年 8 月 17 日
plz help

採用された回答

vishnu andavar
vishnu andavar 2013 年 4 月 17 日
sloution: Matlab Code if true % code end arduino = serial('COM21','BaudRate',9600); % Set ComPort
fopen(arduino);
pause(2.0) % this is very important! arduino needs a little time to initialise the fopen command, because it resets it!
fprintf(arduino,'%s','p9m179g'); %servo on pin 9 to 179 degree
fclose(arduino); delete(arduino) clear arduino
Arduino code: if true % code end #include Servo.h
//DECLARATION--------------------- Servo servo1;
//SETUP---------------------------- void setup() {
Serial.begin(9600);
servo1.attach(9);
}
//LOOP-------------------------------- void loop() {
if( Serial.available() )
{
int x = Serial.read();
servo1.write(x);
}
}

その他の回答 (1 件)

Bhuvnesh Rathor
Bhuvnesh Rathor 2020 年 8 月 17 日
Servo Motor are likewise called Control motors and utilized in feedback control systems as yield actuators. Its newer use for continuous energy transmission or conversion. The standard of the Servo motor is like that of the other electromagnetic motor, yet the development and the activity are extraordinary.

コミュニティ

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by