[vc_row][vc_column][vc_column_text][/vc_column_text][vc_tour][vc_tab title=”Product introduce” tab_id=”1410331525-1-85″][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=”1410331525-2-29″][vc_column_text]
DC Motor Driver Breakout (L298 Chipset)
Arduino Uno
Rover: WiFi Remote Control Robot with WiFi Video Camera
[/vc_column_text][/vc_tab][vc_tab title=”Wiring diagram” tab_id=”1410331902238-2-7″][vc_column_text]
- pinI1=3
- pinI2=4
- speedpinA=9
- pinI3=5
- pinI4=6
- speedpinB=10
[/vc_column_text][/vc_tab][vc_tab title=”Code” tab_id=”1410331903410-3-7″][vc_column_text]
//. Motor driver shield- 2012 Copyright (c) Seeed Technology Inc. // // Original Author: Jimbo.we // Contribution: LG // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA int pinI1=3;//define I1 interface int pinI2=4;//define I2 interface int speedpinA=9;//enable motor A int pinI3=5;//define I3 interface int pinI4=6;//define I4 interface int speedpinB=10;//enable motor B int spead =127;//define the spead of motor void setup() { pinMode(pinI1,OUTPUT); pinMode(pinI2,OUTPUT); pinMode(speedpinA,OUTPUT); pinMode(pinI3,OUTPUT); pinMode(pinI4,OUTPUT); pinMode(speedpinB,OUTPUT); } void forward() { analogWrite(speedpinA,spead);//input a simulation value to set the speed analogWrite(speedpinB,spead); digitalWrite(pinI4,HIGH);/ DC Motor B move clockwise digitalWrite(pinI3,LOW); digitalWrite(pinI2,LOW);/ 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);/ DC Motor B move anticlockwise digitalWrite(pinI3,HIGH); digitalWrite(pinI2,HIGH);/ 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);/ DC Motor B move clockwise digitalWrite(pinI3,LOW); digitalWrite(pinI2,HIGH);/ 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);/ DC Motor B move anticlockwise digitalWrite(pinI3,HIGH); digitalWrite(pinI2,LOW);/ 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(1000); } void loop() { left(); delay(2000); stop(); right(); delay(2000); stop(); // delay(2000); forward(); delay(2000); stop(); backward(); delay(2000); stop(); }
[/vc_column_text][/vc_tab][vc_tab title=”Run and result” tab_id=”1410332312617-4-0″][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
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.