Let's move the robot

Let's move the robot first by turning the motor from obniz.

First, supply power to the robot obniz with a mobile battery etc. and check that the QR is displayed.
Since the smartphone is not placed on the robot this time, you can put the mobile battery in the place where you put the smartphone, or you can fix it with double-sided tape on the top surface.


This time, let's move forward by 2 seconds and stop.
You can also check if the wiring is done with this and if the motor rotates.

The final program looks like this. Let's look at each one.

The program first connects to obniz.

For kits, blocks are provided in the category called "kits".
"Move the robot forward" and "Rotate" are also prepared as blocks, and you can move the robot just by arranging them.

First, set up that obniz is connected to the AI robot kit.
Bring the "Connect airobotki to obniz" block from the "Kit" and connect it after connecting obniz.

Now you can move the robot.

There is also a block in the kit called "Move the airoo bot kit forward"
When this block is executed, the robot will move forward.
Let's connect this under the block and move forward.

After that, we want to stop the robot after a while.

There is no function to do how many meters you should go, so let's make a program that stops after how many seconds.

There is a block called "Wait 500" in the "loop", bring this and connect it.
Then connect the "Stop airobot kit" block in the "Kit" at the end.

"What is waiting?"

"Wait for 500" means to wait for 500 milliseconds.1000 milliseconds is 1 second, 500 means 0.5 seconds.

0.5 seconds is pretty short, isn't it? Increase it to 2000 and let the robot move for 2 seconds.

"Wait for 2000" does not mean that the robot will stop for 2 seconds.
It is the program, not the robot, that waits.In other words, it means "stop the program once until 2000 milliseconds wait until the next block is executed".
The robot is executing a block called "move forward" just before this, and the motor is running.
"Wait 2000" stops the program once, but the motor keeps running.This allows the robot to move forward by 2 seconds.
After 2 seconds, "Stop airobotkit" will be executed.
The motor is stopped for the first time here, and the robot stops.

Try to move

Let's actually move it. Run the block program.

But sometimes it doesn't move forward. It turns like this.
We want to move the side where the smartphone is placed forward.

This is because the motor wiring is reversed.
We wired it at the time of assembly, but We did not care much about the orientation.If you connect the motor in the opposite direction, it will rotate in the opposite direction. Therefore, depending on the wiring, it may rotate or move in the opposite direction.

Let's change the wiring so that it moves in the correct direction.
Let's reverse the wiring of the motor that is rotating in the opposite direction.

If you do, the robot will move forward like this.

You have created your first robot program!