DFRobot MBT0021-EN Посібник - Сторінка 11
Переглянути онлайн або завантажити pdf Посібник для Робототехніка DFRobot MBT0021-EN. DFRobot MBT0021-EN 18 сторінок.
Download the program to the micro:bit, press the "2" button of the infrared remote control, and
Maqueen PlusV2 will drive forward. Press the "4" button, Maqueen PlusV2 turns to the left,
press the "6" button, Maqueen PlusV2 turns to the right, press the "8" button, Maqueen PlusV2
drives backwards.
However, during the operation, we found two problems:
1.When I let the car turn, as long as I press the "4" button or the "6" button, the car will spin on
the spot, the control feels inflexible, and it does not conform to the actual vehicle control
method.
2.When the car is moving backwards, press the "2" button to make the car move forward, and the
car will fall backward due to the reaction force. We try to optimize the code and operating
experience:
Program Link:
https://makecode.microbit.org/_TboWd2ihjD2k
In this example, we have made some changes to the remote control method. When the "4" key
(key value 20) or "6" key (key value 22) is pressed, the car is only allowed to turn for a short
time (200 milliseconds). In this way, we press once, the car rotates a bit, and then continues
straight ahead. If we need a big turn, press it a few more times. When backing, the car will not go
back quickly, which will cause the car to roll over due to inertia. Therefore, we changed the back
function of pressing the "8" key (key value 25) to stop. In this program, we did not write a part
of the program to make the car back. When you write your own program, try to use another
button to realize the back function.