Go Down

Topic: L298 LAP (Read 2105 times) previous topic - next topic

revolver995

Hi , I'm looking for clarification to use of the L298 in LAP.
i've done this circuit with eagle ,  pwm is on the IN1 and IN2 , and i have connected a digital output on the ENABLE ;

so could you tell me if the schematic is correct ? , and how can i programm the pwm with this configuration ? because when the pwm is 50% the motors should  stop;

Thank you

cr0sh

You might want to define what the acronym "LAP" stands for...?
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

oric_dan

From his ckt and description, LAP apparently means Locked Anti-Phase. Some people
use this, I never have. The motors grind too much, full power all the time, lot of heat.

The schematic appears to be ok, but I don't understand "how can i programm the pwm
with this configuration", as it should be apparent.

revolver995

i mean ,how can i write the code for this configuration ? because i have no idea , i might use AnalogWrite (PIN , 255);
but i'm not sure.
Please help me and thank you

oric_dan

http://arduino.cc/en/Reference/DigitalWrite --> HIGH to the enable pins,
http://arduino.cc/en/Reference/AnalogWrite --> 128 to the 4011s.

128 should set the motors to zero speed. 255 --> full forward, 0 --> full reverse.

revolver995

Are you sure about this tipe of code ? because an italian moderator say me that it doesn't work.
Have you tried this code with this configuration ?

Thank you for the answer

revolver995

Quote
Some people
use this, I never have. The motors grind too much, full power all the time, lot of heat.


they told me the exact opposite

oric_dan

Just go on and try it, and see how it works. That's the "proof of the pudding", as they say.
As I mentioned, I haven't done it myself, and I never decide on anything until I've actually
tried it myself.

-Standby

I think i can help you a bit, i am currently working on my bot it's very similar as yours.




Code: [Select]
/*********************************************
****** -Standby @Standby_live.fr**************
***************June 2013*********************/

#define buzPin 6
const int enApin = 3, enBpin = 5;
const int in1pin = 2, in2pin = 4;


byte motorSpeed;

void setup() {
  Serial.begin(9600);
  printMenu();
  pinMode(in1pin, OUTPUT);
  pinMode(in2pin, OUTPUT);
 
}

void loop() {
  if (Serial.available()) {
    char incomingByte = Serial.read();
 
  if (isDigit(incomingByte)) {
    motorSpeed = map(incomingByte, 0, 9, 0, 255);
    analogWrite(enApin, motorSpeed-5); // Calibrating motor to drive straight.
    analogWrite(enBpin, motorSpeed);
  }
 
  switch (incomingByte) {
    case '+':
    bip(50);
    moveForward();
    stopBip();
    break;
   
    case '-':
    bip(50);
    moveBackward();
    stopBip();
    break;
  }
  }
}


void printMenu() {
  Serial.println("Testing H-Bridge with logic gate");
  Serial.println("------ Menu ------");
  Serial.println("Select the speed with 0-9");
  Serial.println("Select the direction with + or -");
}

/**************************
******Robot function******
**************************/

void moveForward() {
  digitalWrite(in1pin, LOW);
  digitalWrite(in2pin, LOW);
}

void moveBackward() {
  digitalWrite(in1pin, HIGH);
  digitalWrite(in2pin, HIGH);
}

void moveRight() {
  digitalWrite(in2pin, LOW);
  digitalWrite(enApin, LOW);
}

void rotateRight() {
  digitalWrite(in1pin, LOW);
  digitalWrite(in2pin, HIGH);
}

void rotateLeft() {
  digitalWrite(in1pin, HIGH);
  digitalWrite(in2pin, LOW);
}

void motorStop() {
  digitalWrite(enApin, LOW);
  digitalWrite(enBpin, LOW);
}

/**************************
*****Buzzer Functions******
**************************/

void bip(int delayMs) {
  analogWrite(buzPin, 50);
  delay(delayMs);
  digitalWrite(buzPin, LOW);
  delay(delayMs);
}

void stopBip() {
  digitalWrite(buzPin, LOW);
}


The Mind is like a parachute it works best when opened.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy