Servo86.stop()

[Servo86]

描述

Stops the servo rotation.

When you call this function, the servo will stop at the current position immediately. The behavior of this function is different from pause(), you cannot resume the servo by resume(), you must reset the target position and call run(), or call write()writeMicroseconds() to make the servo rotate again.

Please note that the servo will still produce power when it is stopped, so please do not turn the servo by hand, otherwise the servo will be damaged.

語法

servo.stop()

參數

servo: Variable of the servo type.

回傳

範例

#include <Servo86.h>
 
Servo myservo;
 
void setup()
{
   myservo.attach(9);
   myservo.write(1500); // turn the servo to the initial position of 1500us
   myservo.run(); // start the servo
   delay(100);
 
   myservo.setPosition(1800, 3000); // Set the target angle of the servo: 1800us, time: 3 seconds
   myservo.run();
   delay(2000); // make the servo spin for 2 seconds
   myservo.stop(); // stop the servo
}
 
void loop() {}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール