Arduino sketch problem

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Murray
 
Posts: 29
Joined: Wed Jul 01, 2009 2:50 am

Re: Arduino sketch problem

Post by Murray »

Is there any way I can get 3 servos to work off motor shield? I am presently using pins 9 and 10 for 2 servos an 2 DC motors connected to motor 1 and 2.

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

Re: Arduino sketch problem

Post by adafruit_support_bill »

The servo library works with any digital pin. As I posted previously, the FAQ describes which pins are available.

daremick
 
Posts: 25
Joined: Wed Sep 26, 2012 10:17 pm

Re: Arduino sketch problem

Post by daremick »

[quote="Murray"]{ resolved one problem there was no driver for uno. That is now fixed. The code now compiles and uploads but it does not work in uno. It does work on a decimilanova board. The pins used oare on the ladyada motor shield.

Hey I am getting the same message when using the motor shield library "motor test" sketch. (or any sketch involving the motor) it says

'AF_DCMotor' does not name a type

you said you found a driver for it that fixed this issue. do you have that driver or remember where you got it from? There doesn't seem to be ANY in-depth tutorials on how to use the adafruit motor shield. There are bits and pieces here and there online but nothing substantial. I would have thought the makers of it would have some kind of PDF or even a youtube video going over the basic functions, connections, code, and usage of the device. When I finish collecting all the bits and pieces of info on the motor shield that I can I intend to make a sizable PDF and tutorial video on the functions, hardware, software, and troubleshooting for it. Thanks in advance for any help. :)

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

Re: Arduino sketch problem

Post by adafruit_support_bill »

@daremick
Hey I am getting the same message when using the motor shield library "motor test" sketch. (or any sketch involving the motor) it says

'AF_DCMotor' does not name a type
That means you do not have the library installed in the correct location. Please refer to the downloads page of the tutorial.
There doesn't seem to be ANY in-depth tutorials on how to use the adafruit motor shield.
There is the original tutorial:
The Updated tutorial:
As well as a very detailed FAQ:
If you have suggestions for improvements, please post them to the feedback link provided here:

daremick
 
Posts: 25
Joined: Wed Sep 26, 2012 10:17 pm

Re: Arduino sketch problem

Post by daremick »

In this picture you can see the library for AFMotor is properly imported, and the error 'AF_DCMotor' does not name a type is still there.
In this picture you can see the library for AFMotor is properly imported, and the error 'AF_DCMotor' does not name a type is still there.
pudding.jpg (138.69 KiB) Viewed 1141 times
I have the library in the proper location as depicted in the picture I uploaded with this post. I also have the .cpp and .h files and yes the file is uncompressed (unzipped) . As you can see in the picture I have the library in the right place and the error message is still there. I'm hopeful Murray might respond to this with where he got the driver.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Arduino sketch problem

Post by adafruit_support_rick »

It looks as if you forgot to rename the folder to "AFMotor", as instructed in the tutorial:
Rename the folder to AFmotor (check that the renamed folder contains the .cpp and .h files) and install into the Arduinosketches/libraries folder.

daremick
 
Posts: 25
Joined: Wed Sep 26, 2012 10:17 pm

Re: Arduino sketch problem

Post by daremick »

So because I named it AFMotor instead of AFmotor it wouldn't accept the library? Well I am still new so I know I have a lot to learn. Thanks for pointing out my mistake driverblock. I renamed it with a lower case m and it worked perfectly. I will continue to work with this and use whatever references I can find. I'm not a fan of having other people do my work for me and I definitely appreciate you pointing out my mistake, thanks for the help :) I'm really liking Arduino!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Arduino sketch problem

Post by adafruit_support_rick »

Ha! See? Even I got it wrong in my post. :roll:
None of us is really happy about the way libraries work in arduino. Installing libraries is probably the single most-common problem issue we see on the forums.
At least now you know where a lot of the land mines are! :wink:

daremick
 
Posts: 25
Joined: Wed Sep 26, 2012 10:17 pm

Re: Arduino sketch problem

Post by daremick »

Agreed, to be fair I guess the libraries are good for reference and getting a few different functions down (learning the basics) but yeah they aren't a college class that's for sure :) To add to that, I actually tried renaming it on my netbook as well because I run the arduino off of my main laptop AND my netbook and my original problems came when I was using my netbook. The library works on my main laptop but not my netbook??? weird. they are both Win7 and have the drivers for my UNO rev3 installed but the motor library won't work on y netbook no matter what i name it, and on my linux (ubuntu) desktop I NEVER have any issues at all lol. I think I'm just going to scrap Windows all together at least for writing the code anyway. for now i'll just stop using the netbook I guess. Thanks again for the advice.

daremick
 
Posts: 25
Joined: Wed Sep 26, 2012 10:17 pm

Re: Arduino sketch problem

Post by daremick »

Actually, another question, and I will be researching this on youtube and google in the mean time, When I run the motor test sketch in the AFmotor library my ?board? or something is making a high pitch squealing noise just before the motor turns on. I'm fairly certain it's not the motor and I'm afraid it might be one of the capacitors with too much current? I'm not really sure. Again i will research this on my own I figured I'd throw it out there in case someone else has experienced this and found a solution, Thanks.

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

Re: Arduino sketch problem

Post by adafruit_support_bill »

something is making a high pitch squealing noise just before the motor turns on
Usually that is from the motor, although it can come from other components as well. The high-pitched noise is the PWM frequency used to control the motor. It is not harmful, but can be annoying. You can change the PWM frequency. See the tutorial for details: http://learn.adafruit.com/afmotor-library-reference

daremick
 
Posts: 25
Joined: Wed Sep 26, 2012 10:17 pm

Re: Arduino sketch problem

Post by daremick »

daremick wrote:To add to that, I actually tried renaming it on my netbook as well because I run the arduino off of my main laptop AND my netbook and my original problems came when I was using my netbook. The library works on my main laptop but not my netbook??? weird. they are both Win7 and have the drivers for my UNO rev3 installed but the motor library won't work on my netbook no matter what i name it.

I solved this problem today! turns out I had a folder named AFmotor with the AFmotor folder inside of it. for whatever reason I guess it can't be in another folder when imported into the library. Maybe the IDE doesn't have the ability to fish through multiple folders for sketches. Anyway after taking AFmotor OUT of the unnecessary folder of the same name it is working perfectly. And thanks Adafruit Support for the suggestion of changing the frequency to get the high pitch noise from PWM to stop; I have not tried this yet but I will do it today... I have been through so many threads on here picking through other posts about issues similar to mine and when I collect all the info I swear I'm going to write a book on this Motor Shield for troubleshooting (open source and free of course). :)

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

Return to “Arduino”