Hi there,
I'm trying to control a solar panel using 2 Pololu DC Motors via a L298 motor driver.
Well, this morning I made some small tests related to the LDRs(photoresistors) serial readings and Pololu DC Motor driving and I figured out something...well, the Pololu DC Motor can't change the sense of rotation on the fly?
Well, I have my motors configured like this:
Each motor has 2 pins, each one responsible for speed and direction...I mean if I want to pwm the first motor in a clockwise direction I will have to send something like this: analogWrite(MotorPin1, 180);
If I want to pwm the same first motor in anti-clockwise direction I will have to send something like this: analogWrite(MotorPin2, 180)...this will work but if I'm doing this:
void loop()
{
analogWrite(MotorPin1, 180);
delay(1000);
analogWrite(MotorPin2, 180);
}
it won't do what's supposed to do...rotating for 1 second in a direction and then suddenly switch to the other direction...and do this over and over....it's my code or this kind of motor is not capable to change the direction of rotation on the fly? Thanks in advance