attach()

描述

指定该物件的伺服马达信号输出脚位。

语法


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

参数

pin:要指定给物件的脚位编号
min(非必要):指定伺服马达角度为 0 度时对应的脉波宽度,单位为微秒,预设为 544 微秒
max(非必要):指定伺服马达角度为 180 度时对应的脉波宽度,单位为微秒,预设为 2400 微秒

范例

#include <Servo.h> 

Servo myservo;

void setup() 
{ 
  myservo.attach(9);
} 

void loop() {} 

See also

attached()
detach()


函式库参考主页面

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.