how-control dc motor using Freeduino motor contol?

is there any where I can find a tutorial about how to use the motor control v1.1a shield (freeduino) (http://www.nkcelectronics.com/arduino-shield-motor-control.html)to control a dc motor?

I am trying to build a line follower robot using ir sensors and controling 2 dc motors.

Is there any code I can look at/use that use the motor control shield?

Thanks!

btw - I found the AFMotor.h library, but it feets the motor shield (arduino), and not the motor-control shield (freeduino).. Is there any library I can use to control this shield?

I’ve had a look at the NKC website and found what arduino pins are used for the motor control and come up with the following demo.

#define DIRECTION_CW 0
#define DIRECTION_CCW 1
#define DELAY_TIME 500
  
int MotorA_Direction = 13; // arduino pin 13
int MotorB_Direction = 12; // arduino pin 12 
int MotorA_Speed = 10; // arduino pin 10
int MotorB_Speed = 9;  // arduino pin 9

void setup()
{
  
  pinMode(MotorA_Direction, OUTPUT);
  pinMode(MotorB_Direction, OUTPUT);
  pinMode(MotorA_Speed, OUTPUT);
  pinMode(MotorB_Speed, OUTPUT);

}

void loop()
{
  int counter1;
  
  digitalWrite(MotorA_Direction, DIRECTION_CW); // set motor A to Clockwise rotation
  
  // start motor at zero speed and ramp up to maximum speed
  for(counter1 = 0; counter1<256; counter1++)
  {
    analogWrite(MotorA_Speed, counter1);
    delay(DELAY_TIME);
  }
  // start motor at maximum and ramp down to zero speed
  for(counter1 = 255; counter1>-1; counter1--)
  {
    analogWrite(MotorA_Speed, counter1);
    delay(DELAY_TIME);
  }
  
  // start again with motor turning the opposite way
 
  digitalWrite(MotorA_Direction, DIRECTION_CCW); // set motor A to Counter Clockwise rotation
  // start motor at zero speed and ramp up to maximum speed
  for(counter1 = 0; counter1<256; counter1++)
  {
    analogWrite(MotorA_Speed, counter1);
    delay(DELAY_TIME);
  }
  // start motor at maximum and ramp down to zero speed
  for(counter1 = 255; counter1>-1; counter1--)
  {
    analogWrite(MotorA_Speed, counter1);
    delay(DELAY_TIME);
  }

  // Now other motor

  digitalWrite(MotorB_Direction, DIRECTION_CW); // set motor B to Clockwise rotation
  // start motor at zero speed and ramp up to maximum speed
  for(counter1 = 0; counter1<256; counter1++)
  {
    analogWrite(MotorB_Speed, counter1);
    delay(DELAY_TIME);
  }
  // start motor at maximum and ramp down to zero speed
  for(counter1 = 255; counter1>-1; counter1--)
  {
    analogWrite(MotorB_Speed, counter1);
    delay(DELAY_TIME);
  }
  
  // start again with motor turning the opposite way
 
  digitalWrite(MotorB_Direction, DIRECTION_CCW); // set motor B to Counter Clockwise rotation
  
  // start motor at zero speed and ramp up to maximum speed
  for(counter1 = 0; counter1<256; counter1++)
  {
    analogWrite(MotorB_Speed, counter1);
    delay(DELAY_TIME);
  }
  // start motor at maximum and ramp down to zero speed
  for(counter1 = 255; counter1>-1; counter1--)
  {
    analogWrite(MotorB_Speed, counter1);
    delay(DELAY_TIME);
  }
  
  // both motors should now be at rest.
  
}

This is the first code I’ve written in ages so I hope it works OK ;D

The clockwise and counter clockwise directions depend on which way you connect your motors.

if you need to change the speed of the ramp up and ramp down then just change the value of DELAY_TIME to something less than 500


Martyn