hey guys i'm using an hbridge to rotate my motor in both directions and using pwm outputs from the arduino to activate each side of the H bridge, but for some reason while the program is running, one side will stay on for a little longer thus causing there to be two inputs into the h-bridge shorting the circuit, i think i programmed it correctly, is there any reason why one output would stay on a little longer then the other? or if there's another way to do this
int left = 10;
int right = 6;
void setup()
{
pinMode(left, OUTPUT);
pinMode(right, OUTPUT);
}
void loop()
{
for (int k=0; k<5; k++)
{
for (int i = 0; i<5; i++)
{
analogWrite(left,180);
delay(830);
analogWrite(left,0);
delay(10);
analogWrite(right,180);
delay(830);
analogWrite(right,0);
delay(10);
}
delay (4000);
}
delay (10000);
}
my hbridge looks like this
where one pwm is sent to one side where the other is turned off and vice versa to flip flop the load on the motor