Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Getting the Motor shield up and running, w/o error code
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Getting the Motor shield up and running, w/o error code

by richile on Sun May 04, 2008 2:20 pm

I copied the AF Motor code the Arduino window, and this error came up:

o: In function `main':
undefined reference to `setup'

What can I do to make this go away? I'm new to this so be gentle.
Thanks
richile
 
Posts: 33
Joined: Sun May 04, 2008 2:05 pm
Location: Colorado

by franklin97355 on Sun May 04, 2008 4:42 pm

Did you follow these steps?
Install the ServoTimer1 library as indicated on its webpage
Make sure you include <ServoTimer1.h>
Create a ServoTimer1 object for each servo you want (up to 2)
Attach the servos to pin 9 (servo A) or 10 (servo B) using attach()
Finally, when you want to set the position of the servo, simply use write(ANGLE) where ANGLE ranges from 0 to 180. 90 is "dead center" for position-servos and "not moving" for continuous-rotation servos.

franklin97355
 
Posts: 21607
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

by richile on Mon May 05, 2008 5:55 pm

Great, thank you. It is working now. Next question: If I want to run a second dc motor would there be a second line under?;
AF_DCMotor motor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

as in;

AF_DCMotor motor(1, MOTOR12_64KHZ); // create motor #1, 64KHz pwm
richile
 
Posts: 33
Joined: Sun May 04, 2008 2:05 pm
Location: Colorado

by adafruit on Tue May 06, 2008 8:17 pm

yes
each motor must be instantiated in that way

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Please be positive and constructive with your questions and comments.