我想找...

搜尋

分享

目錄

Servo86.read()

[Servo86]

描述

Read the current angle of the servo.

語法

servo.read()

參數

servo: Variable of the servo type.

回傳

The current angle of the servo (type is double floating point number), if the servo is not yet out, the return value is 0.0. (Unit: degree)

範例

#include <Servo86.h> 
 
Servo myservo;
double position;
 
void setup() 
{ 
  myservo.attach(9);
  myservo.write(90.0);  // Let the servo turn to 90 degrees
  delay(100); // Delay 100 ms
  position = myservo.read(); // Read the current angle
  Serial.println(position);
} 
 
void loop() {} 

參考


函式庫參考主頁面

86Duino 參考的文本是根據 知識共享署名-相同方式分享 3.0 許可證,部分文本是從 Arduino 參考 修改的。 參考中的代碼示例已發佈到公共領域。

返回頂端