L298N Dual Motor Driver H Bridge (L298N) [B005]
https://www.youtube.com/watch?v=ZqJwD5tuFbE
* GitHub : https://github.com/rdiot/rdiot-b005.git
* Specs
Description:
Using L298N as the control chip,the module has such characteristics as strong driving ability,low calorific value and strong anti-interference ability. This module can use built-in 78M05 for electric work via a driving power supply part. But to avoid the damage of the voltage stabilizing chip, please use an external 5V logic supply when using more than 12V driving voltage. Using large capacity filter capacitor, this module can follow current to protect diodes,and improve the reliability.
Feature:
L298N Double H Bridge Motor Driver Module Control chip: L298N Logical voltage: 5V Drive voltage: 5V - 35V Logical current: 0mA - 36mA Drive current: 2A(MAX single bridge) Storage temperature: -20°C to +135°C Max power: 25W Size: 43 x 43 x 27mm
* Contents
- Connect
12V ------ 9V VCC
GND ----- 9V GND, Arduino GND
5V ----- Arduino 5V
ENA ----- D9
IN1 ----- D2
IN2 ----- D3
OUT1 ----- Motor +
OUT2 ----- Motor -
- Key Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // LCD2004
int dir1PinA = 2;
int dir2PinA = 3;
int speedPinA = 9;
int speed1;
int dir;
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.print("start LCD2004");
pinMode(dir1PinA,OUTPUT); // IN1
pinMode(dir2PinA,OUTPUT); // IN2
pinMode(speedPinA,OUTPUT); // ENA
speed1 = 200;
dir = 1;
delay(1000);
lcd.clear();
}
void loop()
{
lcd.setCursor(0,0);
lcd.print("B005:L298N Driver");
//analogWrite(speedPinA, speed1); // 200 -> ENA
if(dir == 1)
{
digitalWrite(speedPinA, HIGH);
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, HIGH);
lcd.setCursor(0,1);
lcd.print("ENA=" + (String)speedPinA + " HIGH");
lcd.setCursor(0,2);
lcd.print("IN1=" + (String)dir1PinA + " LOW ");
lcd.setCursor(0,3);
lcd.print("IN2=" + (String)dir2PinA + " HIGH ");
delay(5000);
digitalWrite(speedPinA, HIGH);
digitalWrite(dir1PinA, HIGH);
digitalWrite(dir2PinA, LOW);
lcd.setCursor(0,1);
lcd.print("ENA=" + (String)speedPinA + " HIGH");
lcd.setCursor(0,2);
lcd.print("IN1=" + (String)dir1PinA + " HIGH ");
lcd.setCursor(0,3);
lcd.print("IN2=" + (String)dir2PinA + " LOW ");
delay(5000);
digitalWrite(speedPinA, LOW);
lcd.setCursor(0,1);
lcd.print("ENA=" + (String)speedPinA + " LOW ");
lcd.setCursor(0,2);
lcd.print("IN1= STOP ");
lcd.setCursor(0,3);
lcd.print("IN2= STOP ");
dir = 0;
}
}
'3) Actuator > Motor_Driver' 카테고리의 다른 글
L9110S 2-Channel Dual Motor Driver (L9110S) [B042] (0) | 2016.10.05 |
---|---|
ULN2003 Stepper Motor driver (X113647) [B002] (0) | 2016.10.05 |
Control H Bidge Gear Motor Control [P003] (0) | 2016.10.05 |
6~28V 3A Motor Speed Controller [B056] (0) | 2016.10.05 |