release()

描述

釋放一個 Servo 功能的腳位,使該腳位停止送出 PWM 信號,因此,程式中呼叫此函式後,接在此腳位上的伺服機會立即停止出力。另外,此函式也會自動將內部資料初始化,回到 attach() 時的狀態,如果之後要再讓伺服機恢復出力狀態,請呼叫 write()、run()、writeMicrosecond() 其中之一即可。

語法


servo.release()

參數

servoServo86 型別的變數。

回傳

範例

#include <Servo86.h> 

Servo86 myservo;

void setup() 
{ 
  myservo.attach(9);
  myservo.setPosition(1500);  // 設定伺服機的目標位置:1500us
  myservo.run(); // 啟動伺服機
  delay(100);
  myservo.setPosition(1800, 3000); // 設定新的目標位置:1800us,時間:3 秒
  myservo.run();
  delay(1000); // 延遲 1 秒
  myservo.release(); // 釋放伺服機
} 

void loop() {} 

See also

attach()
setPosition()
pause()


函式庫參考主頁面

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.