writeMicroseconds()

描述

设定伺服机目标角度,并且让伺服机转动至目标角度。

请注意,呼叫此函式后会让伺服机立即出力,请避免以手大力转动伺服机,以免受伤或损坏伺服机。

语法


servo.writeMicroseconds(position)

参数

servoServo 型别的变数。

position:目标角度,单位:us。

回传

范例

#include <Servo86.h> 

Servo myservo;

void setup() 
{ 
  myservo.attach(9);
  myservo.writeMicroseconds(1500);  // 让伺服机转到 1500us 的角度
} 

void loop() {} 

See also

write()
read()
readMicroseconds()
setVelocity()


函式库参考主页面

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.