SKU:2020005200(with mainboard)
Buy from US | Buy from UK | Buy from DE | Buy from IT | Buy from FR | Buy from ES | ここでご購入を! |
2020005300 (without mainboard)
Buy from US | Buy from UK | Buy from DE | Buy from IT | Buy from FR | Buy from ES | ここでご購入を! |
In the previous course, we have introduced what is infrared remote control, and use simple experiments to tell you how to use infrared receiver and infrared remote control with micro:bit.
In this lesson, we will use the BBC micro:bit, OSOYOO Robot onboard infrared receiver module and demonstrate how to change the driving direction and status of the car through the infrared remote control, control the car RGB lights, control the micro bit led matrix, etc.
● 1 X USB cable
● 1 X micro:bit robot V1.x
● 1 x OSOYOO Robot for Micro bit
● 1 x 9V battery
● 1 X Infrared controller
IR, or infrared, communication is a common, inexpensive, and easy to use wireless communication technology. IR light is very similar to visible light, except that it has a slightlty longer wavelength. This means IR is undetectable to the human eye – perfect for wireless communication. For example, when you hit a button on your TV remote, an IR LED repeatedly turns on and off, 38,000 time a second, to transmit information (like volume or channel control) to an IR photo sensor on your TV.
If you want more information about IR ,you can see tutorial link :https://osoyoo.com/?p=19435 |
Block |
Analyse |
Examples |
connect ir receiver to block;
When dragged into this block, the program will connect the ir receiver |
||
button press block ;
When dragged into the block ,the car according your button to run |
||
CarCtrl block;
When dragged into the block, the car will always according setting direction to run |
||
Show color block;
show the color by yourself |
||
RGB Car Program ;
When dragged into the block, the RGB will always according setting to show color |
Step 0: Go to url: https://makecode.microbit.org, click New Project
Step 1. In the Toolbox, click on the Basic category and then click the on start block , and then Drag as following figure:
Step 6. Click on the OSOYOO_BlackIR_V3 category again. Drag on IR button “1” pressed block then change 1 to UP as following figure.
Step 8. Click on the Basic category and then click the pause(ms) button, Drag and choose 200ms as following figure:
Step 9. Click on the OSOYOO_Robot category. Drag carCtrl block and place it below previous PAUSE 200ms block, set stop from drop-down menu.
Step 10.Right click on IR button presses block and use Duplicate method six times. Then set down, right, left, star and hash keys to direction as following figure.
Step 11.Click on the OSOYOO_BlackIR_V3 category again. Drag on IR button “1” pressed block then set 1 as following figure..
Step 12. Click on the OSOYOO_Robot category again. Drag RGB Car Big2 value block and place it in on IR button “1” pressed block ,set white from drop-down menu.
Step 13.Right click on IR button “1” pressed block and use Duplicate method two times. Then set 2, 3 keys to colors as following figure.
Step 14.Click on the OSOYOO_BlackIR_V3 category again. Drag on IR button 1 pressed block then change 1 to 4 as per following figure.
Step 15. Click on the Basic category again.And then click the show icon button, Drag and choose heart as following figure:
Step 16.Right click on IR button 4 pressed block and use Duplicate method two times. Then set 5, 6 keys to icon as following figure.
Step 17.Click on the OSOYOO_BlackIR_V3 category again. Drag on IR button 1 pressed block then change 1 to 7 as per following figure.
Step 18.Click on the Neopixel category . Drag strip show color block and place it in on NUM7 button pressed block and delete strip block as per following figure.
Step 19. Click on the OSOYOO_Robot category again. Drag RGB Car Program block and place it in show color red block as per following figure.
Step 20 .Right click on IR button 7 pressed block again ,and use Duplicate method two times. Then set 8 ,9 key to RGB car Program colors as following figure.
Step 21.Click on the OSOYOO_BlackIR_V3 category again. Drag on IR button 1 pressed block then change 1 to 0 as per following figure.
Step 22. Click on the Basic category and drag the pause (ms) button inside on IR button 0 pressed as following:
Step 23.Click Music category . And then drag play tone middle for beat bolck and put it below pause blcok, and choose tone and beat from drop-down menu as per following figure.
Step 24.Duplicate pause block twice and change 100ms to 200ms; Duplicate play tone middle D for 2 beat block; Put three block together as following then drag these blocks inside on IR button 0 pressed and below play tone middle D for 2 beat:
All of the operation is complete, you will see the whole code as per following figure.
Step 25. Rename this project and download the hex file as following.
Note: You can ignore the “Cannot read property ‘onPressEvent’ of undefined” compilation problem in the code. You should still be able to upload the code to your microbit without any problem.
Step A)Please download the whole code https://osoyoo.com/picture/Microbit_Robot/lesson9new/microbit-IR-Control-Robot.zip in your computer. Unzip the download file .
Step B)Connect the micro:bit with the computer through USB cable, and the computer will pop up a U disk and send the download file(.hex)to your micro:bit.
Step C)Insert the micro:bit main board into the robot, and connect a 9v battery into the battery box.
Step D)Turn the POWER switch ON.
After you download the program, you can control the car by remote control.
Note:
1.Before using, the plastic gasket at the rear of the infrared remote controller needs to be removed
2.This experiment must be carried out indoors to reduce interference from sunlight to infrared receiver.
DownLoad Url osoyoo.com