Management of rotation

Hello,

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);
}

Did you forget the question you were going to ask?

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.

MasterKeisan:
I managed to run the engine in the conventional sense , but the reverse seems impossible to do.

Does that mean it goes forwards, but not backwards?

If not, please explain what it does mean.

As well as replying to the questions by other people.

...R

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.

Hi,
What arduino? UNO, Due, Mega?
What motors, spec/data?
Picture of fan motor please, and model sticker if possible.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Can you please post a copy of your sketch, using code tags?
Please use code tags.. See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Tom..... :slight_smile:

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.