Move the robot from the button

Let's use the button that was also used in UI Button Linkage in the block program lesson.

It is a program that advances the robot while pressing the button.

Button display and "If"

To proceed only when the button is pressed, you first need to add a UI button to see if it is pressed in a loop.
And if it is pressed, it will move forward, and if it is not pressed, it will stop.


The end result is a program like this.

First, add a button.Add "Make button with text" from "UI".
Change the text part to "Proceed".
Then, "Connect airobotkit to obniz" enables you to use airobotkit.

From here, prepare "If" by saying "Run all the time" so that it loops.
Put "button is pressed" in "UI" in the condition of if。
And if it is pressed, what you do is "move the airobot kit forward",
If it is not pressed, I want to stop it, so let's stop it with "Stop airobot kit".

When you run it and connect to obniz, a button will appear like this. The button design is slightly different depending on the model.

Let's press the button.The robot will move by pressing。

Your program runs a robot over the internet!
Even if you take your smartphone far away,Even if you go to a different country, you can operate it remotely as long as you have the internet.。