Connect ir receiver to:
This block is used to tell the micro:bit that which port the IR receiver is
connected.
On button pressed:
This block is to detect whether the key on the infrared remote control is
pressed and which key is pressed. In this block, detecting which key was pressed is optional.
When the key we selected is pressed, the IR receiver will run the code we need to process when
the key is pressed.
Download the program to micro:bit to see what happens.
Step2
: Add the package to your Makecode and you can see it
When you press the "1" key on the controller, the LED will turn on; when you
press the "2" key, the LED will turn off. When you press the “3” key, the shaft
of the servo will rotate to 180 degrees(open door); when you press the “4”
key, the shaft of the servo will rotate to 0 degrees(close door).
Result
Can we use remote knowledge to make a remote control car, and if so, what other
components and modules do we need?
Note:
Before using the infrared remote control, please install a coin cell battery for it. The type
of the coin cell battery is CR2025.
42