Arduino Motor Shield,R3

I am using the motor shield with my Uno to drive a Nikko car. The steering has been sorted out but the motor doesn't change speed. I am using the Nikko 7.2 v battery. The motor draws 1.2 amps. The serial monitor displays the increasing count but the speed or voltage across ChanA (on the motor shield) doesn't vary.

Is the Motor shield damaged?

Thanks in advance

// FirstNikkoDemo
// By EP Jasper, 6/2/12
// Uses Arduino Motor Shield, R3
// Drive motor; Blue lead to ChanA+, Red lead to ChanA-
// Steering Servo; Black lead to Gnd., Red lead to 5v.,
// Yellow lead to pin D7

#include <Servo.h>
Servo myservo;
int pos = 0; // variable to store the servo position
int dirA = 12; // pin 12
int speedA = 3; // pin 3

void setup()
{
pinMode (dirA, OUTPUT);
pinMode (speedA, OUTPUT);
digitalWrite (dirA, LOW); // LOW = Reverse
Serial.begin(9600); // initialize serial
myservo.attach(7); // Pin D7
}

void loop()
{
/* for (pos = 30; pos <110; pos += 2)

{
myservo.write(pos); // send position to servo
delay(500); // hold 1.5 seconds
Serial.println(pos); // send it to serial monitor
delay(100);

}
*/

// move the motor A to one direction increasing speed
digitalWrite (dirA, LOW); // Forward
for (int j = 0; j < 133; j += 1)
{
digitalWrite (speedA, j);
delay (2000);
Serial.println(j);
delay(2000);
}

// stop the motor
digitalWrite(speedA, LOW);
delay(100); // keep the motor rolling for one second

}

digitalWrite (speedA, j);

Should be analogWrite, methinks...

   for (int j = 0; j < 133; j += 1)
   {
     digitalWrite (speedA, j);
     delay (2000);
     Serial.println(j);
     delay(2000);
  }

So, every 4 seconds the motor speed will increase by 1. What I've found is a motor won't start until it is around 50/255 of PWM. That means you will wait for 200 seconds before you start to see your motor move.

You were dead-on, John. Thanks for the help. The Nikko motor starts around 100 PWM but that is with the wheels spinning in the air. In any case, now that I have steering AND variable speed drive I can load Nikko with sensors and go forth and solve all sorts of problems in the world. (Delusions of grandeur????)

Thanks again, John. I'll pay more attention to sample code in the future.

Glad to have helped :slight_smile: