Chapter17 :IR 리모트 컨트롤

1.Preparation

1.You should learn about the position of the infrared receiver in the body of hellobot;

2.You should learn about the principle of the infrared infrared receiver.

image0

10-1-1 position of the infrared receiver in the body of hellobot

The infrared receiver is integrated on the left side of the expansion board. When you use the infrared remote controller, the remote controller needs to be aligned with the infrared receiver to receive the signal and perform corresponding actions.

image1

10-1-2 schematic

image2

10-1-3 Pins of Micro:bit

From the schematic diagram. You can see that infrared receiver is connected to P8 of Micro:bit. Therefore, in the program, it is necessary to initialize the infrared receiving pin, and then you can write the program to set the action corresponding to the key value of the infrared remote control.

Infrared remote control principle:

The infrared remote control emits modulated infrared light waves; the infrared receiver receives the infrared signals and converts them into corresponding electrical signals, which are then sent to the post amplifier. In this experiment, we used an infrared remote controller to control the movement of the car.

Note:The infrared obstacle avoidance sensor is not working properly due to the interference of outdoor light. This course needs to be carried out indoors and the curtains are covered to block the outdoor light.

image3

10-1-4 Infrared remote control code value

// 00FF00FF image4 red_colorful lights

// 00FF30CF image5 blue_colorful lights

// 00FF708F image6 purple_colorful lights

// 00FF40BF image7 green_colorful lights

// 00FFA05F image8 stop

// 00FF807F image9advance

// 00FF20DF image10turn left

// 00FF609F image11turn right

// 00FF906F image12back

// 00FF10EF image13turn left in place

// 00FF50AF image14turn right in place

// 00FFB04F 0 sing

// 00FF08F7 1 green_arm colorful lights

// 00FF8877 2 red_arm colorful lights

// 00FF48B7 3 yellow_arm colorful lights

// 00FF28D7 4 Control the servo rotation of J2 interface

// 00FFA857 5 white_arm colorful lights

// 00FF6897 6 Control the servo rotation of J3 interface

// 00FF18E7 7 Control the servo rotation of J2 interface

// 00FF9867 8 blue_arm colorful lights

// 00FF58A7 9 Control the servo rotation of J3 interface

2.Learning goals

In this course, we will study how to control car by infrared controller.

3.Programming

3.1 Programming online

1) You should use the USB cable to connect the micro:bit to the computer, at this point, the computer will have a micro:bit U disk. You need to open it, click micro:bit website, then entered the micro:bit website or you can enter the URL directly in your browser: http://microbit.org/

2) After entering the programming interface, you need to click Add package and copy the HelloBot package URL: https://github.com/lzty634158/HelloBot to the input field, click to confirm the add package. Then you can use the blocks of the HelloBot package.

3.2 Programming offline

  1. You can double-click to use it. As shown in the following figure.

image15

2) After entering the programming interface, you need to click Add package and copy the HelloBot package URL: https://github.com/lzty634158/HelloBot to the input field, click to confirm the add package. Then you can use the blocks of the HelloBot package.

Note: The package only needs to be added once. If you have added packages in the previous lessons, this course does not need to be added repeatedly.

image16

10-1-5 total program

The locations of blocks in the total program are shown in the following figure.

image17

10-1-6

image18

10-1-7

image19

10-1-8

image20

10-1-9

4.Download programming

You need to make sure that the micro:bit development board is connected to the computer. Then you should click on the download in the lower left corner as shown in P 10-1-10 to download the program to micro:bit.

image21

10-1-10

5.Phenomenon

After the code is uploaded. You can control HelloBot by infrared remote controller. When you press image22 and “2” key, colorful lights and arm color lights are become red. When you press image23 and “5” key, colorful lights are become blue and arm color lights are become green. As shown in the following figure. (Just for example)

image24 image25

10-1-11