Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

varying speed with motor shield
Moderators: adafruit_support_bill, adafruit

varying speed with motor shield

by Puck on Thu Feb 07, 2013 11:55 am

I'm using the Adafruit motor shield to control two brushed motors for propulsion on a voice controlled robot. I want to be able to vary the speed, example: "ahead full", "ahead one third" etc, for which I would designate in the code appropriate numbers between 0 and 255, but this would be done in the loop portion of the code where I define the various functions. example:

void aheadOneThird(){
delay(1000); //run time before rechecking sensors and command changes

void aheadFull(){

Would this work or must setSpeed be done in setup? If it must be done in setup, is this number changeable (outside of changing it in the IDE, recompiling and reloading it) if it's in the setup portion of the code? Guidance greatly appreciated. Normally I would just try it, but I'm away from home and do not have access to my boards at the moment.

regards, Richard
Posts: 1
Joined: Wed Sep 21, 2011 6:03 pm

Re: varying speed with motor shield

by adafruit_support_bill on Thu Feb 07, 2013 12:02 pm

You can call setSpeed() at any time.

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