Servo86.readMicroseconds()

[Servo86]

描述

Read the current angle of the servo.

語法

servo.readMicroseconds()

參數

servo: Variable of the servo type.

回傳

The current angle of the servo (type unsigned long integer), if the servo is not yet out, the return value is 0. (Unit: us)

範例

#include <Servo86.h>
 
Servo myservo;
unsigned long position;
 
void setup()
{
   myservo.attach(9);
   myservo.write(90.0); // make the servo go 90 degrees
   delay(100); // delay 100 ms
   position = myservo.readMicroseconds(); // read the current angle
   Serial.println(position);
}
 
void loop() {}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール