创客百科

姿势共享,有节操无门槛参与的创客百科,创客动力之源 \ (^_^) /

用户工具

站点工具


en:arduino:libraries:servowritemicroseconds

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

en:arduino:libraries:servowritemicroseconds [2016/12/25 22:15]
en:arduino:libraries:servowritemicroseconds [2016/12/25 22:15] (当前版本)
行 1: 行 1:
 +[[en:​arduino:​libraries:​servo|Servo]]
 +====== writeMicroseconds() ======
  
 +
 +===== Description =====
 +
 +Writes a value in microseconds (uS) to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft. On standard servos a parameter value of 1000 is fully counter-clockwise,​ 2000 is fully clockwise, and 1500 is in the middle.
 +
 +Note that some manufactures do not follow this standard very closely so that servos often respond to values between 700 and 2300. Feel free to increase these endpoints until the servo no longer continues to increase its range. Note however that attempting to drive a servo past its endpoints (often indicated by a growling sound) is a high-current state, and should be avoided.
 +
 +Continuous-rotation servos will respond to the writeMicrosecond function in an analogous manner to the write function.
 +===== Syntax =====
 +
 +servo.writeMicroseconds(uS)
 +===== Parameters =====
 +
 +servo: a variable of type Servo
 +
 +uS: the value of the parameter in microseconds (int)
 +===== Example =====
 +<code cpp>
 +#include <​Servo.h> ​
 +
 +Servo myservo;
 +
 +void setup() ​
 +
 +  myservo.attach(9);​
 +  myservo.writeMicroseconds(1500); ​ // set servo to mid-point
 +
 +
 +void loop() {} 
 +</​code>​
 +===== See also =====
 +
 +  * attach()
 +  * read()
 +[[en:​arduino:​libraries|Reference Home]]
en/arduino/libraries/servowritemicroseconds.txt · 最后更改: 2016/12/25 22:15 (外部编辑)