Pages: [1]   Go Down
Author Topic: L298 LAP  (Read 1812 times)
0 Members and 1 Guest are viewing this topic.
Roma
Offline Offline
Full Member
***
Karma: 0
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 5594
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You might want to define what the acronym "LAP" stands for...?
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Roma
Offline Offline
Full Member
***
Karma: 0
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Roma
Offline Offline
Full Member
***
Karma: 0
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Roma
Offline Offline
Full Member
***
Karma: 0
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Paris
Offline Offline
Full Member
***
Karma: 1
Posts: 180
Beyond the possible...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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




Code:
/*********************************************
****** -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);
}

Logged

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

Pages: [1]   Go Up
Jump to: