Simple Motor Shield Problem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Simple Motor Shield Problem

by abidemoment on Sat Nov 10, 2012 8: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!

Posts: 1
Joined: Sat Nov 10, 2012 7:59 pm

Re: Simple Motor Shield Problem

by adafruit_support_mike on Sun Nov 11, 2012 12:48 am

The simplest solution is shown in the tutorial:


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.

Posts: 43219
Joined: Thu Feb 11, 2010 2:51 pm

Re: Simple Motor Shield Problem

by adafruit_support_bill on Sun Nov 11, 2012 6: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.

Posts: 61630
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.