www.keyestudio.com
//stop
delay(2000);//delay in 2s
}//*****************************************
(7) Test Result
Hook up by connection diagram, upload code and power on, smart
car goes forward and back for 2s, turns left and right for 2s, stops
for 2s and alternately.
(8) Code Explanation
digitalWrite(ML_Ctrl,LOW):
the rotation direction of motor is
decided by the high/low level and and the pins that decide rotation
direction are digital pins.
analogWrite(ML_PWM,200):
the speed of motor is regulated by
PWM, and the pins that decide the speed of motor must be PWM
pins.
(9) Extension Practice
Adjust the speed that PWM controls the motor, hook up in same
way
139