I managed to run the engine in the conventional sense , but the reverse seems impossible to do.I also have a Motor Shield.I gpt yet attempted to reverse the direction by imposing a negative value but it does not work. I can also not use the H-bridge that the engine must be able to rotate in both directions as a result . Here is the traditional code. Thank you in advance.
int motor1_enablePin = 7; //pwm
int motor1_in1Pin = 4;
int motor1_in2Pin =5;
void setup()
{
//on initialise les pins du moteur 1
pinMode(motor1_in1Pin, OUTPUT);
pinMode(motor1_in2Pin, OUTPUT);
pinMode(motor1_enablePin, OUTPUT);
}
void loop()
{
SetMotor1(255, true);
}
//Fonction qui set le moteur1
void SetMotor1(int speed, boolean reverse)
{
analogWrite(motor1_enablePin, speed);
digitalWrite(motor1_in1Pin, ! reverse);
digitalWrite(motor1_in2Pin, reverse);
}
Please indicate what motor (Type, brand, model, etc.), and the name of the motor shield. This will make it much easier to diagnose your problem and solve it.
Mmmmmh sorry if i forget the question . xD
I want know what parameters i need to change to make the motor turn backwards.
The motorshield is from the site arduino and the motor is a Mini-Fan.
If you have a brushless fan, it is not a motor, it is a brushless motor driver plus a
brushless motor and will not work if the supply is reversed (it may be damaged in fact).
If you have just a DC motor then you can reverse it. Fans are not normally powered
by DC motors.