Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

tutorial code for servo drive
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

tutorial code for servo drive

by georgelstuart on Sun Aug 10, 2008 11:57 pm

Limor,
I bought your motordriver shield and am having the following problem getting it running - as suggested in your tutorial, I started with the servo sketch, I copied and pasted your tutorial servo driver code into rev 11 of the arduino IDE and at upload I get the following error-

undefined reference to 'ServoTimer1::attach(int)'

I have the Library installed, and in fact used the
Sketch/Import Library/ServoTimer1 menu path to include the library.
any idea what might be wrong? I have played with arduino enough to have become leery of using random code that I find on the internet - I have found that it often doesn't compile right and yields errors that I don't understand, but in this case, it is such simple looking code and is in fact your tutorial, so I thought you might have some input.
thanks,
George
georgelstuart
 
Posts: 5
Joined: Sat Aug 09, 2008 10:33 pm

by adafruit on Mon Aug 11, 2008 12:10 am

i didnt write the servotimer code (it is part of the core arduino library set) but the code on the page definately compiled fine for me before. check your library install?

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

by georgelstuart on Mon Aug 11, 2008 12:20 am

Well,
thanks for the quick reply. You must be monitoring the site. I guess I'll go to Arduino.cc and see if I can figure out what the deal is. I'll have to admit I am having some frustrating problems with libraries. Or at least what I assume are problems with the libraries. I hoped that this was not the case here because it did come from the Arduino web site and your site, probably the two most trusted sources for arduino stuff.
thanks,
George
georgelstuart
 
Posts: 5
Joined: Sat Aug 09, 2008 10:33 pm

by adafruit on Mon Aug 11, 2008 2:24 pm

i always install them 'by hand' and then look thru the folders to make sure they are ok and always delete any .o files

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

libraries

by georgelstuart on Tue Aug 12, 2008 11:20 pm

Sorry for the newb question, but what do you mean by hand? Is that by typing in directly the #include.... command or by using the Arduino IDE to navigate to the appropriate file and manually select it? Also, I went through my library folders and each of them has a .o file in it... are you suggesting that this is a problem and I need to go through and delete the .o files? thanks in advance for any response.
George
georgelstuart
 
Posts: 5
Joined: Sat Aug 09, 2008 10:33 pm

by adafruit on Wed Aug 13, 2008 1:23 am

you have to put the library -into- the hardware/libraries folder as described in the installation instructions
http://www.arduino.cc/en/Main/Libraries

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

libraries

by georgelstuart on Wed Aug 13, 2008 6:30 pm

Yes, thanks, I got that, after all it is in the documentation.
I have been having inexplicable trouble running code that others seem to have no problem with - your servo demo code is a good example and I am starting to think that I am having some kind of trouble with the libraries. Maybe you are onto something with these mysterious .O files. I have one in each library folder. You say you delete them. I tried moving them to another folder to see if that would delink them from the Library. So far it doesn't seem to make any difference but I haven't tried restarting the Arduino IDE yet. That might help...
Anyway, I was asking what you mean by "By Hand". Do you simply type the #include... line in your code or do you manually navigate through the menus to Sketch/Import Library/select library and let the IDE link it? I suppose it probably doesn't make any difference as I would assume that the compiler takes care of the code linking when it does it's magic...
georgelstuart
 
Posts: 5
Joined: Sat Aug 09, 2008 10:33 pm

by adafruit on Wed Aug 13, 2008 7:00 pm

i always put in the #include

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

motor shield for stepper

by georgelstuart on Tue Sep 09, 2008 1:23 pm

Hey,
Re previous thread, I found out that my problem was due to "unapproved libraries" that somehow gummed up the .o build process for all libraries. Now I ditched a few libraries that apparently were the problem and got the servo drive kinda working, thanks. (kinda working because the servo moves back and forth which I consider a victory, but it only moves about 10 degrees back and forth, not the full to-the-stops rotation I was expecting) I will worry about that later.

On to stepper drive and I am having trouble with this as well. I am not using an actual Arduino, but a Freeduino and of course your motor shield doesn't plug directly into it so I am using a breadboard to wire it up. I think it is possible that I am not getting the right output pins tied into the motor shield. As you would expect, I cannot have both 0-7 and 8-13 on the breadboard at the same time. I looked through the .cpp file of your AFMotor library and am not good enough with C to see what output pins are used for steppers and you don't mention it in the tutorial... so anyway the point I am getting to is what IO pins are used to drive the steppers on your motor shield and the AFMotor library?
I hope this longwinded question makes sense.
thanks again,
George
georgelstuart
 
Posts: 5
Joined: Sat Aug 09, 2008 10:33 pm

by adafruit on Tue Sep 09, 2008 3:19 pm

see the schematics for wiring
the shield is designed for arduinos so you are sorta on your own if you want to adapt it to something else...

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

Please be positive and constructive with your questions and comments.