当前位置:首页 > 科学研究 > 电子编程 > 正文内容

Arduino Project 030B - MX1508 H-Driver Motor

RonWang5个月前 (11-23)电子编程265

MX1508 H-BridgeDual Motor Driver

The driver can drive up to two motors. The H-Bridge dual motor driver module is connected to the arduino where it receives signals. The signal pins on the driver are four, two for  each motor. One signal pin makes the motor move in a particular direction of rotation but the other one makes it move the opposite way. This same principle works for the other motor. The driver receives an input voltage from 5v to 12v . There is a voltage regulator that sets the voltage down. This power source can be used to power the arduino board.

MX1508S Motor Driver


30B MX1508 Motor Driver Single Circuit


arduino MX1508 Motor Driver Single Schematic

/*
  MX1508 DC MOTOR DRIVER MODULE
  One Motor Project
*/
void setup() {
  pinMode(8, OUTPUT); //IN2
  pinMode(9, OUTPUT); //IN1
}
void loop() {
// Full speed forward
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  delay(3000);
// Full speed backward
  digitalWrite(8, LOW);
  digitalWrite(9, HIGH);
  delay(3000);
// 0 to 100% speed in forward mode
  for (int i=0;i<256;i++)
  {   digitalWrite(8, HIGH);
      analogWrite(9, i);
      delay(30);      
      }
  delay(60);
  // 0 to 100% speed in backward mode
        for (int i=255;i<0;i--)
  {   digitalWrite(8, LOW);
      analogWrite(9, i);
      delay(30);      
      }
        delay(60);
}


arduino MX1508 Motor Driver Dual Circuit

arduino MX1508 Motor Driver Dual Schematic

/*
  MX1508 DC MOTOR DRIVER MODULE
  Dual motor project  
*/

int motor1clockwise=3; // motor one clockwise signal connected to pin 3
int motor1anticlockwise=4; //motor one anticlockwise signal connected to pin 4
int motor2clockwise=5; //motor two clockwise signal connected to pin 5
int motor2anticlockwise=6; // motor two anticlockwise signal connected to pin 6
void setup(){
Serial.begin(9600);
//  declare all motor pins as OUTPUTS
pinMode(motor1clockwise,OUTPUT);
pinMode(motor1anticlockwise,OUTPUT);
pinMode(motor2clockwise,OUTPUT);
pinMode(motor2anticlockwise,OUTPUT);
}
void loop(){
digitalWrite(motor1clockwise,HIGH); //move motor one clockwise
delay(1000);
digitalWrite(motor1clockwise,LOW); //stop motor one clockwise
digitalWrite(motor1anticlockwise,HIGH); //move motor one anticlockwise
delay(1000);
digitalWrite(motor1anticlockwise,LOW); //stop motor one anticlockwise
digitalWrite(motor2clockwise,HIGH); //move motor two clockwise
delay(1000);
digitalWrite(motor2clockwise,LOW); // stop motor two clockwise
digitalWrite(motor2anticlockwise,HIGH); //move motor two anticlockwise
delay(1000);
digitalWrite(motor2anticlockwise,LOW); // stop motor two anticlockwise
}



版权声明:本文为原创文章,版权归donstudio所有,欢迎分享本文,转载请保留出处!

本文链接:http://www.parentscn.com/?id=287

标签: Arduino

相关文章

Arduino Project 032 - BMP280 Pressure Sensor LCD Display

Arduino Project 032 - BMP280 Pressure Sensor LCD Display

For this project we will use Arduino Uno and BMP280 along with LCD 16x2 display module to display te...

C语言调试运行环境Pelles C的安装

C语言调试运行环境Pelles C的安装

C语言调试运行环境之TurboC一文介绍了在32位Windows系统下安装C语言运行环境之TubroC,但是由于TurobC只能在32位系统下运行,导致现在很多Windows10和Windows 11...

 Arduino Project 038 - Simple Ultrasonic Range HC-SR04

Arduino Project 038 - Simple Ultrasonic Range HC-SR04

Ultrasonic range finders measure distance by emitting a pulse of ultrasonic sound that travels throu...

 Arduino Project 033 - 4 Digital 7 Segment Display

Arduino Project 033 - 4 Digital 7 Segment Display

Showing Heep and number 0-9 on a Common Anode 7-segment LED display. Displays the numbers 0-9 on the...

Arduino Project 025 - Servo Control

Arduino Project 025 - Servo Control

You will need to obtain a standard RC servo; any of the small or mid-sized servos will do. Larger se...

Arduino Programming Basic - If and Loop

Arduino Programming Basic - If and Loop

Arduino 程序基础,介绍Arduino程序的基本组成,第一部分编写了10个例子,关于变量及变量名称,串口监视器,if循环,for循环,while循环等。第二部分介绍了函数,全局变量,局部变量和静...