Keyestudio Smart Little Turtle Robot V3 Manual page 135

Table of Contents

Advertisement

www.keyestudio.com
//right
digitalWrite(ML_Ctrl,LOW);//set the direction control pin of A motor to
LOW level
analogWrite(ML_PWM,200);//set the PWM control speed of A motor to
200
digitalWrite(MR_Ctrl,HIGH);// set the direction control pin of B motor to
HIGH level
analogWrite(MR_PWM,200);//set the PWM control speed of B motor to
200
delay(2000);//delay in 2000ms
//stop
analogWrite(ML_PWM,0);//set the PWM control speed of A motor to 0
analogWrite(MR_PWM,0);//set the PWM control speed of B motor to 0
delay(2000);// delay in 2000ms
}
//****************************************************************************
(7) Test Result:
Hook up by connection diagram, upload code and power on, the smart car
goes forward and back for 2s, turns left and right for 2s, stops for 2s and
alternately.
135

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents