Schematic is too simple to draw. I've got one of these L298N boards:
ENA and ENB are jumpered on.
Arduino #8 --> IN1
Arduion #9 --> IN2
#10 --> IN3
#11 --> IN4
OUT1/2 to one pair of stepper wires. Out 3/4 to the other pair
12V supply to the 12V pin on the L298N board. Same for ground. Nothing connected to the 5V pin on the L298N board.
I've tried various example code.
I guess my questions whether this should work.
int IN1=8;//connected to Arduino's port 3
int IN2=9;//connected to Arduino's port 4
int IN3=10;//connected to Arduino's port 6
int IN4=11;//connected to Arduino's port 7
void setup()
{
pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(IN3,OUTPUT);
pinMode(IN4,OUTPUT);
}
void loop()
{/*In the way of 4 beats to drive the stepping motor,A group connected to motorA,B
B group connected to motorB,Suppose A representing the forward current of A group,
A- representing the reverse current of A group,B representing the forward current of B group,
B- representing the reverse current of B group.
this way run as follow:
AB A-B A-B- AB-
or
AB AB- A-B- A-B
*/
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
delay(10);
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
delay(10);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
delay(10);
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
delay(10);
}