Simple Motor Shield Problem

by AbideMoment on Sat Nov 10, 2012 7:07 pm

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!
AbideMoment
 
Posts: 1
Joined: Sat Nov 10, 2012 6:59 pm

Re: Simple Motor Shield Problem

by adafruit_support_mike on Sat Nov 10, 2012 11:48 pm

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7068
Joined: Thu Feb 11, 2010 1:51 pm

Re: Simple Motor Shield Problem

by adafruit_support_bill on Sun Nov 11, 2012 5:40 am

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.
User avatar
adafruit_support_bill
 
Posts: 25416
Joined: Sat Feb 07, 2009 9:11 am