All Tutorials / Professor E / The Robot Program Episode 021: Detect Face and Wave - Blockly

The Robot Program Episode 021: Detect Face and Wave - Blockly

Save As PDF

Description

This lesson will demonstrate how to use Blockly to have the robot wave once it detects a face. At the end of this lesson, readers will be able to enable facial detection and code a basic script using Blockly. Follow along with The Robot Program Episode 021: Detect Face and Wave - Blockly.

View the video episode here: https://www.ez-robot.com/Tutorials/Lesson/95

Controls

This tutorial uses the following controls. Select a control to view the manual page.

Professor E's Overview

This lesson demonstrated how to enable facial detection and how to trigger an action using a Blockly script.

Always start with a fully charged, disconnected robot. Load EZ-Builder and connect to the robot. Open the bare robot project, which provides a clean workspace without unnecessary controls.
Add the control for the camera and test the camera view. The camera will provide peripheral information (external input/output that can be used to provide information).

Open the Blockly workspace. Add the Wait For Face command. This command tells the robot to wait until it detects a face before moving on to the next line of code.

Add Say EZB and type in the desired speech. This command does not include a Wait, so it will execute and move immediately to the next command while the robot is still speaking. The audio will be output through the EZ-B Robot Controller.

Add AutoPosition (Wait) and choose an action, such as Wave. The use of Wait means that the action will be fully completed before moving on to the next line of code.

Click on Start to begin execution. Use the Code tab to view the EZ-Script code that was generated by the Blockly commands.

Remember to disconnect, power off, and charge the robot when finished.

User-inserted image