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.