The sound is from the PWM used to control the motor speed. You can use a higher frequency, specified in the motor constructor. See the library reference for details: http://learn.adafruit.com/afmotor-library-reference
I am also new to Arduino and the Motor shield from Adafruit and had a similar problem. The Motor test example supplied has the following in the "include" section:
AF_DCMotor motor(4);
Reading the tutorial it indicates that to increase the PMW frequency you need to use outputs 1 or 2, which allows an increase in frequency, and to change the above as follows:
AF_DCMotor motor(2, MOTOR12_64KHZ);
This doesn't work and luckily I have an oscilloscope which proved that this didn't work. Copying this to the setup section however works.
This is most confusing to a newcomer so please update your example.
just saw the last post, I havent managed to get it to work yet, dont know it it will provide any help but ill attach a picture of the motor im using — it comes from a printer.
Try the suggestion from intheframe and let us know how it works.
Also, be careful using that motor with the shield. Although the normal running current (0.46A) is within the capabilities of the L293D H-Bridge chips, the stall current (3A) is enough to burn out the chip.
Ive started to play around with this again, is it possible to see what current the motor iss made for?
Im powering the shield with a external 12v current. When running the motor it runs slow, when attaching the motor straight to the 12v it runs much faster. Would it be an idea to power it with 24v? I dont understand the numbers printed on the motor — or if it's possible to read anything from it.
Id like to drive 4 of these motors, would that be possible or are they to big for the shield, if so is there any other shield i could use?
The first number printed on the motor is the model number. A google search turns up the specifications here: http://www.mabuchi-motor.co.jp/cgi-bin/ ... D=rs_545ph
It looks like it will handle up to 24v. But the stall current is 3A. What do you want to do with these motors? Do you need both direction and speed control?
sorry, i realize that i could have googled the number myself, but i now understadn what stall current is. The idea is that each motor should winch a fishing line with a flourocent light tube attached. So i only need the direction. SHould i try find another shield or look for other motors? I dont want to burn the bridge.