by adrianovrm » Fri 7. Mar 2014, 18:54
L think l can help you in using this H-brigde, it is excact the same h-brigde l use onto my project , it has a special to manage the pwm and CC and CCW movements.
1. The jumpers must the close just at EA and CA . Leave EAB and CAB open, this are the jumpers near the conector bourne.
2. At conector Bourne we will have the PA and PB and EA and - . This 4 conectors must be connect to arduino like that:
PA : CC or CCW [0 or 1 logical] -> values 0 (low) and 255 (high) for arduino
PB : PWM Must be a PWM pin;
EA : ENABLE of the motor , always High for motor move
- : Must be attached to the arduino gnd;
How the H bridge must be programmed at arduino:
Lets say that you use pin 13 for EA pin 8 for PA and 6 for PB,
So a simple code to make arduino move your motor !
//----
// the setup routine runs once when you press reset:
void setup()
{
pinMode(13, OUTPUT);
pinMode(8, OUTPUT);
pinMode(6, OUTPUT);
digitalWrite(13, HIGH); // enabling motor movement - when digitalWrite(13, LOW); motor doent move .
}
// the loop routine runs over and over again forever:
void loop()
{
// moving CC of CCEW depending on connection of the terminal motors onto M1 and M2 point of the simple H
digitalWrite(8, HIGH);
analogWrite(6,0);
delay(5000);
digitalWrite(8, LOW);
analogWrite(6,255);
delay(5000);
// l dont know if xpid.ino is prepare to work with this simple H - cause each H have the way of commanding
// is xpid.ino is not prepare to that - it will not work with the simple H . have to look the code
// l have my own file (arduino.ino) - l just pick so fast code from xpid.ino - very few things - but logical is similar
// but my code is much bigger cause it works with lcd - sdcards and keyboard . so it hard to you understand now - l
// suggest a study of arduino programming - l think you will need . l have just teachers of arduino in portugueses but
// sure you can find guys teaching arduino language and english in youtube.
}
// obs - digitalwrite and digitalread commands are slow when compared with direct bit access, but it is advance for you // now - lets wire on things simple for now - to make you feel taste or blood heheheheh...
// ---------