猿问

arduino 控制舵机?

arduino 控制舵机


慕运维8079593
浏览 832回答 3
3回答

明月笑刀无情

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

肥皂起泡泡

attach()DescriptionAttach 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.Syntaxservo.attach(pin)&nbsp;servo.attach(pin, min, max)Parametersservo: a variable of type Servopin: the number of the pin that the servo is attached tomin (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 alsoattached()detach()Reference HomeCorrections, suggestions, and new documentation should be posted to the&nbsp;Forum.The text of the Arduino reference is licensed under a&nbsp;Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
随时随地看视频慕课网APP
我要回答