Hello, I would like to know how I am supposed to connect L298N to arduino according to schematic;
http://robotoid.com/appnotes/circuits-bridges.html?
I connected OUTPUT pin 2 and 3 to motor, V+ for motor pin 4 to power supply (+) 5V and (-) to ground, INPUT1 pin 5 to arduino's output pin 6, ENABLE pin 6 to arduino pin 5V, INPUT2 pin 7 to arduino's output pin 7, GROUND pin8 to ground (-), V+ for L298N I connected to arduino 5V pin. In the end I have 5V on OUTPUT pin 2 and 3 and the motor is not running. Is something missing?
what are you using for a sense resistor ?
these tell the chip what power to output to allow you to limit power and protect your motor.
dave-in-nj:
what are you using for a sense resistor ?
these tell the chip what power to output to allow you to limit power and protect your motor.
I didn't use any resistor, I just used the 1st (basic) and 4th diagrams.
Your software.
I am using Arduino software.
My code
int pinM1=6;
int pinM2=7;
int Byteout=0;
int space=32;
float val=0;
void setup(){
Serial.begin(9600);
pinMode(pinM1,LOW);
pinMode(pinM2,LOW);
}
void loop(){
if(Serial.available()>=0){
char Byteout=Serial.read();
Serial.write(space);
if(Byteout=='f'){
Serial.print("forward");
val=analogRead(A0)*5.00/1023;
Serial.write(space);
Serial.print(val,3);
Serial.write(space);
digitalWrite(pinM1, HIGH);
digitalWrite(pinM2, LOW);
char Byteout=Serial.read();
}
if(Byteout=='b'){
Serial.print("backward");
Serial.write(space);
digitalWrite(pinM1, LOW);
digitalWrite(pinM2, HIGH);
char Byteout=Serial.read();
}
if(Byteout=='s'){
Serial.print("stop");
Serial.write(space);
digitalWrite(pinM1, HIGH);
digitalWrite(pinM2, HIGH);
char Byteout=Serial.read();
}
}
delay(100);
}