描述
暫停轉動中的伺服機。 請注意,暫停後的伺服機仍會出力,請勿用手大力轉動,否則容易造成伺服機損壞。 若要使暫停的伺服機繼續轉動,請呼叫 resume()。
語法
servo.pause()
參數
servo:AIServo 型別的變數。
回傳
無
範例
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <AIServo86.h>
AIServoPort(ROBOTIS, AX12) bus;
AIServo myservo;
void setup()
{
bus.begin(Serial3, 1000000);
myservo.attach(bus, 3);
myservo.write(150); // 將伺服機轉到 150 度的位置
delay(600);
}
void loop()
{
myservo.setPosition(280, 3000); // 設定伺服機的目標角度:280 度,時間:3 秒
myservo.run();
delay(1000);
myservo.pause(); // 伺服機暫停轉動
delay(1000); // 暫停 1 秒
myservo.resume(); // 伺服機恢復轉動
delay(3000);
}
|
See also
- attach()
- setPosition()
- resume()
86Duino 参考资料中的文本修改自 Arduino 参考资料,并根据 知识共享署名-相同方式共享 3.0 许可证 授权。参考资料中的代码示例已发布到公共领域。