The problem is fix bad connection
I have a Cytron MD10C that is connected to a 12v dc motor and I would like to control the speed and direction of the motor with a arduino uno.
Connection:
The 12 volts battery is connected to the terminal ( + & - ) and the motor is connected to the terminal ( A & B ) on the MD10C.
The (Vin) is connected to the 12 volts battery for supplying the MD10C board.
The (DIR) is connected on pin 8 on the arduino uno. (DIR = direction of the motor)
The (PWM) is connected on pin 9 who is a (pwm).
The (GND) is connected on the ground on the arduino uno.
On the board there is two buttons A & B. When A is activate the motor will turn in one direction and when B is activate the motor turn’s in the other direction. So the MD10C is working correctly.
SEE THE attachment.
The problem:
When everything is connected I’m sending a (1-HIGH or 0-LOW) to pin 8 for direction and a value between 0 and 255 to pin 9 for speed. Nothing work’s included the led for direction A or B but the led for power is working. I tested the wires between the MD10C and arduino uno for continuity and everything look Ok.
Code on the back of MD10C board:
PWM DIR Motor A Motor B
1 x LOW LOW
1 0 HIGH LOW
1 1 LOW HIGH
Arduino uno code:
This code is just for testing the MD10C and arduino uno to run the motor.
[code]int pinPwm = 9;
int pinRotation = 8;
void setup(){
Serial.begin(9600);
pinMode(pinPwm,OUTPUT);
pinMode(pinRotation,OUTPUT);
}
void loop(){
digitalWrite(pinRotation,HIGH); // turn in one direction
analogWrite(pinPwm,200);
delay(2000);
digitalWrite(pinPwm,LOW); // stop motor
delay(1000);
digitalWrite(pinRotation,LOW); // turn in other direction
analogWrite(pinPwm,100);
delay(2000);
}[/code]
I also try this code for the (loop())
void loop(){
digitalWrite(pinPwm,HIGH); // <<<<<<<
digitalWrite(pinRotation,HIGH); // turn in one direction
analogWrite(pinPwm,200);
delay(2000);
digitalWrite(pinPwm,LOW); // stop motor
delay(1000);
digitalWrite(pinPwm,HIGH); //<<<<<<<<
digitalWrite(pinRotation,LOW); // turn in other direction
analogWrite(pinPwm,100);
delay(2000);
}
If you have any suggestions why the MD10C is not working please let me know.
If you also have a Arduino code for running the motor with the MD10C.
Thanks again for your help.