DFRobot MBT0021-EN Podręcznik - Strona 6

Przeglądaj online lub pobierz pdf Podręcznik dla Robotyka DFRobot MBT0021-EN. DFRobot MBT0021-EN 18 stron.

DFRobot MBT0021-EN Podręcznik
6. MakeCode Graphical Programming
How to use MakeCode:
MakeCode Library Address:
6.1 Light-controlled Maqueen Plus
The following program calls the light sensor of the micro:bit motherboard. Normally, the car is
in a stopped state, and the RGB light at the bottom lights up in color. When the flashlight
illuminates the front side of the micro:bit, the car goes forward, the bottom RGB light goes out,
and the front lights turn on.
The value of the light sensor is an analog value between 0 and 255, which is used to indicate the
intensity of light. In the program, we take a light intensity value of 100 as the demarcation point.
When the light intensity is greater than 100, the car is started, otherwise, the car is stopped.
Program Link:
https://makecode.microbit.org/_26hJo3HLbaqw
6-2 Sound-controlled Maqueen Plus(only supports micro:bit V2.0)
The following program calls the sound sensor on the micro:bit V2 motherboard. When you clap
your hands, the car starts to drive and turns on the lights. When you clap your hands again, the
car stops and turns off the lights. Repeat in this way.
In the program, when the sound is detected to be greater than 100, the state of a Boolean value is
reversed. Next, the program checks whether the Boolean value is true, if it is true, the car moves
forward, if it is false, the car stops.
https://wiki.dfrobot.com/Makecode%20Get-started%20Tutorial
https://github.com/DFRobot/pxt-DFRobot_MaqueenPlus_v20