Servo86.attach()

[Servo86]

描述

Assign the Servo object to one of the output pins. When this function is called, the voltage on the specified pin will be initialized to LOW.

語法

servo86.attach(pin)
servo86.attach(pin, min, max)

參數

  • servo: Servo type of the variable.
  • pin: Pin number.
  • min (optional): The minimum PWM pulse width in microseconds (us). If there is no input value or the input value is less than 450, the default value of 450 us will be used internally as the minimum PWM width.
  • max (optional): The maximum PWM pulse width in microseconds (us). If there is no input value or the input value is greater than 2800, the default value of 2800 us will be used as the maximum PWM width.

回傳

範例

#include <Servo86.h> 
 
Servo myservo;
 
void setup() 
{ 
  myservo.attach(9); // Initialize pin 9 as Servo pin
} 
 
void loop() {} 

參考


函式庫參考主頁面

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

發表評論

上部へスクロール