为了账号安全,请及时绑定邮箱和手机立即绑定

arduino 控制舵机?

arduino 控制舵机?

慕运维8079593 2019-02-04 10:06:30
arduino 控制舵机
查看完整描述

3 回答

?
明月笑刀无情

TA贡献1828条经验 获得超4个赞

Arduino自带的Servo函数库只可以同时控制两个模拟舵机。而且最好接到数字9 、 10脚上。想控制多个舵机就要使用到Arduino的Pwm功能了。 你也可以使用 32路伺服电机控制器 方便驱动多个舵机。

查看完整回答
反对 回复 2019-03-26
?
肥皂起泡泡

TA贡献1829条经验 获得超6个赞

attach()

Description

Attach the Servo variable to a pin. Note that in Arduino 0016 and earlier, the Servo library supports only servos on only two pins: 9 and 10.

Syntax

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

Parameters

servo: a variable of type Servo

pin: the number of the pin that the servo is attached to

min (optional): the pulse width, in microseconds, corresponding to the minimum (0-degree) angle on the servo (defaults to 544)

max (optional): the pulse width, in microseconds, corresponding to the maximum (180-degree) angle on the servo (defaults to 2400)

Example

#include <Servo.h>

Servo myservo;

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

void loop() {}


See also

  • attached()

  • detach()

  • Reference Home

    Corrections, suggestions, and new documentation should be posted to the Forum.

    The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.


查看完整回答
反对 回复 2019-03-26
  • 3 回答
  • 0 关注
  • 831 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信