Hi.
I have read all the documentation on the web around the Fundumoto board (discussed in the thread above) but still cant get my motors to work properly. PLEASE can someone help me.
The right motor (motor B) just spins in reverse no matter what instruction is given. This seems to me that pin 13 which is the direction for motorB is not giving the HIGH current as required to send the FORWARD direction. Could this be a timer problem (I am unfortunately a newbie and really don't understand the timers.)
Motor A works fine so this tells me the code is probably not the problem.
Please, does someone have some advice for me on this!!!
I attach the code:
#define SpeedA 10 //left motor is A
#define DirectionA 12
#define SpeedB 11 //right motor is B
#define DirectionB 13
#define MoveSpeed 150
#define SpeedAdjustment 0
void setup() {
delay(5000);
}
void loop() {
Forward(2000);
delay(500);
//Backward(2000);
delay(500);
//TurnRight(500);
delay(500);
//TurnLeft(1000);
delay(500);
//SpinRight(500);
delay(500);
//SpinLeft(1000);
delay(500);
}
/-------( DO NOT EDIT, THIS IS THE FUNCTIONS AREA FOR MOTOR CONTROL )--------------------/
void Forward(int howLong)
{
digitalWrite(DirectionA,HIGH);
digitalWrite(DirectionB, HIGH);
analogWrite(SpeedA, MoveSpeed);
analogWrite(SpeedB, MoveSpeed);
delay(howLong);
Stop();
}
/---------------------------/
void Backward(int howLong)
{
digitalWrite(DirectionA,LOW);
digitalWrite(DirectionB, LOW);
analogWrite(SpeedA, MoveSpeed);
analogWrite(SpeedB, MoveSpeed);
delay(howLong);
Stop();
}
/---------------------------/
void Stop()
{
digitalWrite(DirectionA,LOW);
digitalWrite(DirectionB, LOW);
analogWrite(SpeedA, 0);
analogWrite(SpeedB, 0);
}
/---------------------------/
void TurnLeft(int howLong)
{
digitalWrite(DirectionA,HIGH);
digitalWrite(DirectionB, HIGH);
analogWrite(SpeedA, 0);
analogWrite(SpeedB, MoveSpeed);
delay(howLong);
Stop();
}
/---------------------------/
void TurnRight(int howLong)
{
digitalWrite(DirectionA,HIGH);
digitalWrite(DirectionB, HIGH);
analogWrite(SpeedA, MoveSpeed);
analogWrite(SpeedB, 0);
delay(howLong);
Stop();
}
/---------------------------/
void SpinRight(int howLong)
{
digitalWrite(DirectionA,HIGH);
digitalWrite(DirectionB, LOW);
analogWrite(SpeedA, MoveSpeed);
analogWrite(SpeedB, MoveSpeed);
delay(howLong);
Stop();
}
/---------------------------/
void SpinLeft(int howLong)
{
digitalWrite(DirectionA,LOW);
digitalWrite(DirectionB, HIGH);
analogWrite(SpeedA, MoveSpeed);
analogWrite(SpeedB, MoveSpeed);
delay(howLong);
Stop();
}
/---------------------------/
//( THE END )**