Keyestudio Ks0428 Manual page 141

Table of Contents

Advertisement

www.keyestudio.com
pinMode(ML_PWM, OUTPUT);//define the PWM control pin of
left motor as OUTPUT
pinMode(MR_Ctrl, OUTPUT);//define the direction control pin of
right motor as OUTPUT
pinMode(MR_PWM, OUTPUT);//define the PWM control pin of
right motor as OUTPUT
}
void loop()
{ digitalWrite(ML_Ctrl,LOW);//Set direction control pin of left motor
to LOW
analogWrite(ML_PWM,100);// Set the PWM control speed of left
motor to 100
digitalWrite(MR_Ctrl,LOW);//Set the direction control pin of right
motor to LOW
analogWrite(MR_PWM,100);//Set the PWM control speed of
right motor to 100
//front
delay(2000);//define 2s
digitalWrite(ML_Ctrl,HIGH);//Set direction control pin of left
motor to HIGH level
analogWrite(ML_PWM,250);//Set the PWM control speed of left
motor to 100
141

Advertisement

Table of Contents
loading

Table of Contents