AIServo.run()

[AIServo86]

描述

Start the servo (i.e., the servo starts to produce power).

If you have already called setPosition() to set the target angle, the servo will start to rotate to the angle you set.

Please note that since this function will make the servo start immediately, please avoid turning the servo by hand to avoid injury or damage to the servo.

語法

servo.run()

參數

servo: Variable of the AIServo type.

回傳

範例

#include <AIServo86.h>
  
AIServoPort(ROBOTIS, AX12) bus;
AIServo myservo;
  
void setup()
{
   bus.begin(Serial3, 1000000);
   myservo. attach(bus, 3);
   myservo.setPosition(200); // Set to rotate to 200 degrees at the fastest speed
   myservo.run(); // turn the servo
   delay(1000);
   myservo.setPosition(100, 1000); // set to turn to 100 degrees, it takes 1 second
   myservo.run(); // start the servo
   while(myservo. isMoving());
}
  
void loop() {}

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール