From this time, let's do a program like an AI robot instead of a button.
Place your smartphone on the robot and try to move forward when you find someone on the camera.
It's not too difficult because you can proceed if there is a person in the camera, just like pressing a button to proceed.
How to use the camera was in the block program lesson
Please refer to.
Prepare the camera and use "If" in the loop.
Set "The face is in the camera" as the condition on if.
This allows it to make different movements when the face is visible and when it is not visible.
When it is in the picture, insert a block to move the robot forward so that it can move forward.
Place a block to stop when it is not shown.
Then it looks like this.
Set the smartphone on the robot.
Then open the program on your smartphone and run it.
When you connect to obniz, the "Are you sure you want to use the camera?" Dialog is displayed. Click "Allow".
Then the image of the camera is displayed, and if there is a person in it, move forward as shown in the video below.