Chapter5 :로봇팔의 숨쉬는 불빛 만들기¶
1.Preparation¶
1.You should learn about the position of the magic lights in the arm of hellobot;
2.You should learn about the principle of touch magic lights;
3.You should learn about the micro:bit pins connected to the magic lights in the schematic.
(a)touch magic lights on the left arm (b)touch magic lights on the right arm
2-2-1 touch magic lights on arm of hellobot
The touch magic light is mounted on the two arms of the HelloBot robot, one for each of the left and right arms. The touch magic light is a whole module consisting of a touch module and a colorful water light.
(a)magic lights (b)touch position
2-2-2 touch magic lights module
2-2-3 about wiring
2-2-4 schematic
2-2-5 Pins of Micro:bit
From the schematic diagram in P2-2-4, you can see that the touch magic lights is connected to the P6, P9 of the Micro:bit.
Note:In the bottom layer of the HelloBot package has been set parameter for the user, you can directly drag the touch magic lights building blocks.
- Learning goals
In this course, we learns the new game of touch magic lights - breathing lights. Breathing light: the touch magic lights are changed gradually from light to dark by the control of the micro:bit. It feels like a person is breathing.
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
- You can double-click to use it. As shown in the following figure.
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.
2-2-6 total program
The locations of blocks in the total program are shown in the following figure.
2-2-7
2-2-8
2-2-9
2-2-10
2-2-11
2-2-12
2-2-13
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 2-2-14 to download the program to micro:bit.
2-2-14
5.Phenomenon
After the code is uploaded. You can see that the colorful lamps of robot are changed gradually from light to dark by the control of the micro:bit. It feels like a person is breathing. As shown in the following figure.
2-2-15