Programming problem with my motorshield

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
wakebaby1
 
Posts: 4
Joined: Sun Nov 07, 2010 6:02 pm

Programming problem with my motorshield

Post by wakebaby1 »

I am trying to run a simple motor code on my adruino with a adafruit motor shield. I have installed the afmotor to my library. However no matter what code i use including the example code on the AFMotor library I keep getting the same error. It says AF-DC MOTOR DOES NOT HAVE A NAME TYPE.
Here is the sample code I am currently trying to use. Please help.
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>

AF_DCMotor motor(4);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Motor test!");

// turn on motor
motor.setSpeed(200);

motor.run(RELEASE);
}

void loop() {
uint8_t i;

Serial.print("tick");

motor.run(FORWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}

for (i=255; i!=0; i--) {
motor.setSpeed(i);
delay(10);
}

Serial.print("tock");

motor.run(BACKWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}

for (i=255; i!=0; i--) {
motor.setSpeed(i);
delay(10);
}


Serial.print("tech");
motor.run(RELEASE);
delay(1000);
}

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Programming problem with my motorshield

Post by adafruit_support_bill »

Sounds like the library is not properly installed. Check the library tutorial: http://www.ladyada.net/library/arduino/libraries.html

wakebaby1
 
Posts: 4
Joined: Sun Nov 07, 2010 6:02 pm

Re: Programming problem with my motorshield

Post by wakebaby1 »

I checked my library and it shows the AFMotor in there ? After looking at the link you sent on libraries it seems like it is correct but I am not sure. How would I knoew if it was in the right spot ?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Programming problem with my motorshield

Post by adafruit_support_bill »

What OS are you running and where was your library installed?

wakebaby1
 
Posts: 4
Joined: Sun Nov 07, 2010 6:02 pm

Re: Programming problem with my motorshield

Post by wakebaby1 »

Windows 7.
Library is installed in my library folder inside the arduino IDE

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Programming problem with my motorshield

Post by adafruit_support_bill »

Older versions of the Arduino IDE had the library directories in the IDE folder. For more recent versions of the Arduino IDE, libraries should be installed in your document folder:

C:\Users\<user name>\Documents\Arduino\Libraries

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”