Simple Motor Shield Problem

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
abidemoment
 
Posts: 1
Joined: Sat Nov 10, 2012 7:59 pm

Simple Motor Shield Problem

Post by abidemoment »

For my engineering class, I need to design a robot (car) that travels 10 feet, drops off a payload on a target, then proceeds 10 feet to the finish line. What I have set up is an Arduino Uno with an Adafruit motorshield that runs to a DC motor inside a gearbox and a small RC micro servo with an arm that knocks the payload off the back of the robot. I want the motor shield to run the DC motor for however long it takes to go 10 feet, then pause, then initiate the servo to knock off the payload, then reinitiate the DC motor so it can proceed to the finish line. How do I get the motor to just simply run at a constant speed for a couple seconds, then stop, then reinitiate after the servo does its job? Thanks!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Simple Motor Shield Problem

Post by adafruit_support_mike »

The simplest solution is shown in the tutorial:

http://www.ladyada.net/make/mshield/use.html

Set the motor speed, tell it to start, then call 'delay()' to wait for a fixed amount of time. Then you can tell your servo to dump and run the motor the other way.

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

Re: Simple Motor Shield Problem

Post by adafruit_support_bill »

Keep in mind that motor speed is going to be dependent on battery level and load - as well as the rolling resistance of the test surface. A solution based only on motor run-time is not going to give very precise or repeatable results.

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

Return to “Other Arduino products from Adafruit”