极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 11396|回复: 5

求救....步進馬達不動

[复制链接]
发表于 2013-1-20 00:42:09 | 显示全部楼层 |阅读模式
我是新手一個,剛買了四個 28BYJ-48 連ULN2003APG,在網上找了幾個編碼測試,四顆指示燈閃動,但馬達全無反應,就連一點聲音也沒有,次序也反覆掉換試了幾次還是不動,四個馬達也不動,求高人指點
回复

使用道具 举报

发表于 2013-1-20 09:55:53 | 显示全部楼层
确认步进马达的驱动方式,很多电机走步方式不一样滴。。。
回复 支持 反对

使用道具 举报

发表于 2013-1-20 10:46:18 | 显示全部楼层
问卖家要驱动信号的资料,比如我买的

  The sequence of control signals for 4 control wires is as follows:

  Step C0 C1 C2 C3
     1  1  0  0  0
     2  0  1  0  0
     3  0  0  1  0
     4  0  0  0  1

驱动函数就是

void Stepper::stepMotor(int thisStep)
{
  if (this->pin_count == 2) {
    switch (thisStep) {
      case 0: /* 01 */
      digitalWrite(motor_pin_1, LOW);
      digitalWrite(motor_pin_2, HIGH);
      break;
      case 1: /* 11 */
      digitalWrite(motor_pin_1, HIGH);
      digitalWrite(motor_pin_2, HIGH);
      break;
      case 2: /* 10 */
      digitalWrite(motor_pin_1, HIGH);
      digitalWrite(motor_pin_2, LOW);
      break;
      case 3: /* 00 */
      digitalWrite(motor_pin_1, LOW);
      digitalWrite(motor_pin_2, LOW);
      break;
    }
  }
  if (this->pin_count == 4) {
    switch (thisStep) {
      case 0:    // 1000
      digitalWrite(motor_pin_1, HIGH);
      digitalWrite(motor_pin_2, LOW);
      digitalWrite(motor_pin_3, LOW);
      digitalWrite(motor_pin_4, LOW);
      break;
      case 1:    // 0100
      digitalWrite(motor_pin_1, LOW);
      digitalWrite(motor_pin_2, HIGH);
      digitalWrite(motor_pin_3, LOW);
      digitalWrite(motor_pin_4, LOW);
      break;
      case 2:    //0010
      digitalWrite(motor_pin_1, LOW);
      digitalWrite(motor_pin_2, LOW);
      digitalWrite(motor_pin_3, HIGH);
      digitalWrite(motor_pin_4, LOW);
      break;
      case 3:    //0001
      digitalWrite(motor_pin_1, LOW);
      digitalWrite(motor_pin_2, LOW);
      digitalWrite(motor_pin_3, LOW);
      digitalWrite(motor_pin_4, HIGH);
      break;
    }
  }
}

你根据你的改吧
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-1-21 23:07:25 | 显示全部楼层
ttyp 发表于 2013-1-20 10:46
问卖家要驱动信号的资料,比如我买的

  The sequence of control signals for 4 control wires is as fo ...

須看不懂,還須說句謝謝
回复 支持 反对

使用道具 举报

发表于 2013-1-22 09:00:23 | 显示全部楼层
就是需要对4个线发送高低电平才会推动步进电机走的,比如我的是依次发送
1000,0100,0010,0001是正转,反过来就是倒转,各个厂家生产的步进电机的时序是不一样的,需要问卖家要资料
回复 支持 反对

使用道具 举报

发表于 2013-1-26 08:51:14 来自手机 | 显示全部楼层
ttyp 发表于 2013-1-20 10:46:18
问卖家要驱动信号的资料,比如我买的

  The sequence of control signals for 4 control wires is as follows:

  Step

你好,你的代码前部分看不懂,能解释下吗来自: Android客户端
回复 支持 反对

使用道具 举报

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

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

Archiver|联系我们|极客工坊

GMT+8, 2024-5-3 21:20 , Processed in 0.049428 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

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