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.

../_images/remote_control.png

Note

You can refer to How to Use the Remote Control Function?. Come and carry out this project smoothly.

Program

Note

  • You can write the program according to the following picture, please refer to the tutorial: How to Create a New Project?.

  • Or find the code with the same name on the Examples page of the EzBlock Studio and click Run or Edit directly.

../_images/remote.png

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

../_images/remote_B.png

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.

../_images/sp210927_180739.png

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”.

../_images/sp210927_182447.png

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.

../_images/sp210927_182828.png

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.

../_images/sp210927_183237.png

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