Let's move the flag

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

First, supply power to obniz from a computer or mobile battery, and check that the QR is displayed.If you can confirm it, let's program it.

Program

We have also prepared a video from nothing to the completion of this program.

https://youtu.be/fQqXtxfvmG4

This time, We will try the movement of "raising the flag and lowering it after 2 seconds".

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".
Raising and lowering the flag is also prepared in blocks.

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

Now you can use the servo motor, distance sensor, etc. included in the kit from obniz.

There is also a block in the kit called "Raise the flag of the iot home kit".
When this block is executed, the servo motor will rotate and the flag will rise.
We want to raise the flag and lower it a little later.s

There is a block called "Wait 500" in the "loop", bring this and connect it.Then bring "Raise the flag of iothome kit" in "Kit" again, connect it at the end, and change "Raise" to "Lower".

"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.Let's increase it to 2000.

Even if we say "wait for 2000", it doesn't mean that you will stop for 2 seconds.
It is the program that waits, not the obniz side.In other words, it means "stop the program once until 2000 milliseconds wait until the next block is executed".
Even if it wait, it don't lower the flag without permission.

The program will stop once at "Wait 2000", but the flag will remain raised because it says "Raise the flag".
After 2 seconds, "Lower the flag of iothomekit" will be executed. The flag goes down here.

Try to move

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

Will the flag move?

The flag was attached at the time of assembly.
So the m flag seems be out of position.

Now remove the entire disk (black circle) and adjust the position.

Let's move it again. If you move like this, you are successful!

You have your first program!