This subject comes up too often and nothing ever gets done (on account of fragile egos and hurt feelings, subject-changing, sabotage, and so on.)
In a recent subject, I tried taking a guy's side in this matter, but I became the worst person in the world for doing so.
Arduino, H-bridges, and the Madness of Crowds: More hate, more vituperation, more character assassination, and hysteria, hysteria, hysteria (Oh, Yes); but nothing in the way of critical thinking and/or logical problem solving.
So, here's an all-NPN h-bridge that works. Having a little fun while I exorcise the Demons of Ignorance, happy in my chore - pounding a stake into the heart of hysteria.
It's not a panacea nor is it supposed to be a panacea. It's good for this, running some horrible little Mabuchi motor or whatever. Do I have to make it run a little car? (If you have demonstrated "doer credentials" you can dare me to.)
Let the haters hate, let the carpers carp.
// hbtool_01
byte A_Dir = 8;
byte B_Dir = 9;
byte A_Spd = 10;
byte B_Spd = 11;
byte motoff = 13;
void setup ()
{
pinMode (A_Dir,OUTPUT);
digitalWrite (A_Dir,LOW);
pinMode (B_Dir,OUTPUT);
digitalWrite (B_Dir,LOW);
pinMode (A_Spd,OUTPUT);
digitalWrite (A_Spd,LOW);
pinMode (B_Spd,OUTPUT);
digitalWrite (B_Spd,LOW);
pinMode (motoff,OUTPUT);
digitalWrite (motoff,HIGH);
}
void loop()
{
// running DIRection A
digitalWrite (motoff,LOW);
digitalWrite (A_Dir,HIGH); // enable A
analogWrite (A_Spd,50);
delay (2500);
analogWrite (A_Spd,100);
delay (2500);
analogWrite (A_Spd,250);
delay (2500);
digitalWrite (A_Spd,LOW);
digitalWrite (A_Dir,LOW); // DISable A !! or Die! ?
digitalWrite (motoff, HIGH);
delay (1500);
// running DIRection B
digitalWrite (motoff,LOW); // enable B
digitalWrite (B_Dir,HIGH);
analogWrite (B_Spd,50);
delay (2500);
analogWrite (B_Spd,100);
delay (2500);
analogWrite (B_Spd,250);
delay (2500);
digitalWrite (B_Spd,LOW); // DISable B !! or Die! ?
digitalWrite (B_Dir,LOW);
digitalWrite (motoff, HIGH);
delay (1500);
}
Only the inquiring mind solves problems.
I bid you Peace!





