[vc_row][vc_column][vc_column_text]
[/vc_column_text][vc_tour][vc_tab title=”Product Description” tab_id=”1410318697-1-29″][vc_column_text]![]()
Specification:
- chipset: L298N
 - Driving power supply voltage Vs: +5V to +46V
 - Peak current of driving power supply Io: 2A
 - Vss: +5V to +7V
 - Current of logic power supply: 0 – 36mA
 - PWM control signal range:
- Low level: -0.3V < Vin < 1.5V
 - High level: 2.3V < Vin< Vss
 
 - Enable signal range:
- Low level: -0.3V
 - High level: 2.3V < Vin< Vss
 
 - Maxium power consumption: 25W
 - Working temperation: -25C to 130C
 
[/vc_column_text][/vc_tab][vc_tab title=”Hardware prepare” tab_id=”1410318697-2-62″][vc_column_text]
DC Motor Driver Breakout (L298 Chipset)![]()
pcDuino3: A20 Single Board Computer supports Arduino Programming
Rover: WiFi Remote Control Robot with WiFi Video Camera
[/vc_column_text][/vc_tab][vc_tab title=”Wire diagram” tab_id=”1410325419469-2-1″][vc_column_text]
pinI1 of Motor shield  - >       pin 8  on pcDuino pinI2 of Motor shield  - >       pin 11 on pcDuinospeedpinA of Motor shield  - >   pin 12 on pcDuinopinI3 of Motor shield     - >    pin 9  on pcDuinopinI4 of Motor shield  - >       pin 13    on pcDuinospeedpinB of Motor shield  - >   pin 10  on pcDuino                   
[/vc_column_text][/vc_tab][vc_tab title=”Test Code” tab_id=”1410325420469-3-8″][vc_column_text]
#include <core.h>
 
#define pinI1     8  //define IN1 interface
 
#define pinI2     11 //define IN2 interface 
 
#define speedpinA 9  //enable motor A
 
#define pinI3     12 //define IN3 interface 
 
#define pinI4     13 //define IN4 interface 
 
#define speedpinB 10 //enable motor B
 
#define spead     200 //define the spead of motor
 
void forward()
 
{
 
     analogWrite(speedpinA,spead);//input a simulation value to set the speed
 
     analogWrite(speedpinB,spead);
 
     digitalWrite(pinI4,HIGH);//turn DC Motor B move clockwise
 
     digitalWrite(pinI3,LOW);
 
     digitalWrite(pinI2,LOW);//turn DC Motor A move anticlockwise
 
     digitalWrite(pinI1,HIGH);
 
}
 
void backward()
 
{
 
     analogWrite(speedpinA,spead);//input a simulation value to set the speed
 
     analogWrite(speedpinB,spead);
 
     digitalWrite(pinI4,LOW);//turn DC Motor B move anticlockwise
 
     digitalWrite(pinI3,HIGH);
 
     digitalWrite(pinI2,HIGH);//turn DC Motor A move clockwise
 
     digitalWrite(pinI1,LOW);
 
}
 
void left()
 
{
 
     analogWrite(speedpinA,spead);//input a simulation value to set the speed
 
     analogWrite(speedpinB,spead);
 
     digitalWrite(pinI4,HIGH);//turn DC Motor B move clockwise
 
     digitalWrite(pinI3,LOW);
 
     digitalWrite(pinI2,HIGH);//turn DC Motor A move clockwise
 
     digitalWrite(pinI1,LOW);
 
}
 
void right()
 
{
 
     analogWrite(speedpinA,spead);//input a simulation value to set the speed
 
     analogWrite(speedpinB,spead);
 
     digitalWrite(pinI4,LOW);//turn DC Motor B move anticlockwise
 
     digitalWrite(pinI3,HIGH);
 
     digitalWrite(pinI2,LOW);//turn DC Motor A move clockwise
 
     digitalWrite(pinI1,HIGH);
 
}
 
void stop()
 
{
 
     digitalWrite(speedpinA,LOW);
 
   //Unenble the pin, to stop the motor. This should be done to avid damaging the motor. 
 
     digitalWrite(speedpinB,LOW);
 
     delay(2000);
 
}
 
void setup()
 
{
 
  pinMode(pinI1,OUTPUT);
 
  pinMode(pinI2,OUTPUT);
 
  pinMode(speedpinA,OUTPUT);
 
  pinMode(pinI3,OUTPUT);
 
  pinMode(pinI4,OUTPUT);
 
  pinMode(speedpinB,OUTPUT);
 
}
 
void loop()
 
{
 
  left();
 
  delay(2000);
 
  stop();
 
  right();
 
  delay(2000);
 
  stop();
 
  forward();
 
  delay(2000);
 
  stop();
 
  backward();
 
  delay(2000); 
 
  stop(); 
 
}
[/vc_column_text][/vc_tab][vc_tab title=”Run and result” tab_id=”1410327669643-4-2″][vc_column_text]
Input the code into Arduino IDE, then click compile and upload
You will see the led light and the car will move

Leave a Reply
You must be logged in to post a comment.