Manual
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Sample Code
// # Editor : Lauren from DFRobot
// # Date : 17.02.2012
// # Product name: L298N motor driver module DF-MD v1.3
// # Product SKU : DRI0002
// # Version : 1.0
// # Description:
// # The sketch for using the motor driver L298N
// # Run with the PWM mode
// # Connection:
// # M1 pin -> Digital pin 4
// # E1 pin -> Digital pin 5
// # M2 pin -> Digital pin 7
// # E2 pin -> Digital pin 6
// # Motor Power Supply -> Centor blue screw connector(5.08mm 3p
connector)
// # Motor A -> Screw terminal close to E1 driver pin
// # Motor B -> Screw terminal close to E2 driver pin
// #
// # Note: You should connect the GND pin from the DF-MD v1.3 to your MCU
controller. They should share the GND pins.
// #
int E1 = 6;
int M1 = 7;
int E2 = 5;
int M2 = 4;
void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}
void loop()
{
int value;
for(value = 0 ; value <= 255; value+=5)