Skip to content

Latest commit

 

History

History
58 lines (31 loc) · 1.95 KB

ezblock_remote_control.rst

File metadata and controls

58 lines (31 loc) · 1.95 KB

Remote Control

In this project, we will learn how to remote control the PiCrawler. You can control the PiCrawler to move forward, backward, left, and right.

image

Note

You can refer to ezblock:remote_control_latest. Come and carry out this project smoothly.

Program

Note

  • You can write the program according to the following picture, please refer to the tutorial: ezblock:create_project_latest.
  • Or find the code with the same name on the Examples page of the EzBlock Studio and click Run or Edit directly.

image

Switch to the Remote Control interface, and you will see the following widgets.

image

After the program is running, you can activate PiCrawler through D-Pad.

How it works?

After dragging out the widget on the Remote Control interface, a category named Remote will appear in the block categories column of the programming interface.

Here we add the D-Pad widget, so the D-Pad get value block appears here.

image

D-Pad can be regarded as a four-in-one button. You can choose which button to read in the second groove of the block.

When the button is pressed, the value is "1"; when the button is not pressed, the value is "0".

image

We used an if block (you can find it in the Logic category on the left) to make the PiCrawler move forward once when the UP button of the D-pad is pressed.

image

You can click the gear icon on the upper left of the block to modify the shape of the if block to realize multiple judgment branches.

image

if block is usually used with = block, = block can be modified to >, < and other conditions through the drop-down menu, please use it flexibly.