极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12794|回复: 5

arduino怎么控制电调来驱动电机 急急急 求大神帮帮忙

[复制链接]
发表于 2016-5-28 17:28:45 | 显示全部楼层 |阅读模式
arduino怎么控制电调来驱动电机     急急急    求大神帮帮忙
回复

使用道具 举报

发表于 2016-5-29 13:55:13 | 显示全部楼层
输出PWM控制
回复 支持 反对

使用道具 举报

发表于 2016-5-30 07:44:47 | 显示全部楼层
有专门的驱动电机的模块 或者用2003自己做
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-5-30 14:04:54 | 显示全部楼层
电机大了L298驱动不了   要用电调来
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-5-30 17:30:18 | 显示全部楼层
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-5-30 17:30:52 | 显示全部楼层
这个程序怎么用蓝牙模块控制啊
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-27 09:21 , Processed in 0.039704 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表