Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

DC MOTOR SPEED
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

DC MOTOR SPEED

by shengfatt on Thu Sep 04, 2008 4:33 am

i have 2 dc motor but i want the speed of the two motor different during different condition. does the below code work?
#include <AFMotor.h>

AF_DCMotor motor1(2, MOTOR12_64KHZ);
AF_DCMotor motor2(3, MOTOR12_64KHZ);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps

}

void loop() {

motor1.run(FORWARD); //M2(first motor) turn it on going forward
motor1.setSpeed(200); // set the speed to 200
delay(1000);

motor2.run(FORWARD); // M3(second motor) turn it on going forward
motor2.setSpeed(255); // set the speed to 255
delay(1000);


}


Thnak you :D
shengfatt
 
Posts: 3
Joined: Wed Aug 27, 2008 12:39 am

by adafruit on Thu Sep 04, 2008 11:39 am

yes

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by adafruit on Thu Sep 04, 2008 11:43 am

yes

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Please be positive and constructive with your questions and comments.