Day 14: AI With PictoBlox & Quarky

Lesson Description

Learn to connect Quarky with PictoBlox.understand nested conditional statements.explore the concept of the Face Mimic Robot.apply knowledge through the Face Mimic Robot activity.

Connect Quarky With PictoBlox..

Follow the steps below:

  1. Open PictoBlox App, go to My Space, and click on + button to create a new file.
  2. Let’s begin by first connecting Quarky to
    1. Turn ON Quarky with the switch on the back side of the
    2. Click on the Board sign.
    3. Select the Quarky board.
    4. Click on Connect sign.
    5. Select the appropriate Quarky device from the list.
    6. You will be prompted with the message Device Connected.

Explain Nested Conditional Statements

Nested conditional statements are like putting one decision inside another decision. It’s like having a question inside another question!

Conditional Statements

A conditional statement is like asking a question to make a decision. For example, if it’s raining, you might decide to take an umbrella. The question “Is it raining?” helps you decide what to do next.

Nested Conditional Statements

Now, let’s add a little twist to our question. What if we need to ask another question based on the first one? This is where nested conditional statements come in.

Example Story

Let’s imagine a story with our friends Montu and Shera:

Montu and Shera’s Adventure

  1. Montu and Shera are planning to play outside.
  2. First, they check if it’s raining:
    1. If it’s raining, they will check if they have raincoats:
      1. If they have raincoats, they will play outside.
      2. If they don’t have raincoats, they will stay indoors.
    2. If it’s not raining, they will check if it’s sunny:
      1. If it’s sunny, they will go to the park.
      2. If it’s not sunny, they will stay indoors and play a board game.

Breaking it Down

Here’s how Montu and Shera’s decision-making process looks like:

  1. Is it raining?
    • Yes:
      • Do we have raincoats?
        • Yes: Play outside.
        • No: Stay indoors.
    • No:
      • Is it sunny?
        • Yes: Go to the park.
        • No: Stay indoors and play a board game.

Conditional Blocks in PictoBlox

  1. if () then block The if () then block will check whether the specified condition is true or not. If it is true, the blocks inside it will run, and the script will continue. If the condition is false, the code inside the block will be ignored and the script will move The condition is checked only once.
  2. The if () then else block will check whether the specified condition is true or If the condition is true, the code held inside the first C (below the if arm) will run. Then, the script will continue; if the condition is false, the code inside the second C (below the other arm) will run. (Unlike the if () then block).

Activity :Face Mimic Robot

Is the expression of face () ()

is expression of face () ()

The is expression of face () () block checks whether the selected face has a particular emotion or not. If the emotion matches, then the block returns true, else false.

E.g., for face 1 in the image, the emotion is Happy.

is expression 2

Setting Up the Stage

  1. Drag and drop a when flag clicked block into the scripting area.
  2. Snap a turn () video on stage with () transparency block from the Face Detection. Change the camera option to on and transparency to 0%.

The stage is set. Click the green flag to get the camera feed on the stage.

Recognize Image

  1. Add a forever block from the Control palette.
  2.  Snap a analyse image from () block. Select the feed as the camera.

Mimicking Expressions

Follow the simple step below:

  1. Add an if block below the say () block in the same script. Using this block we’re going to check which expression has been detected. Let us first check for the happy expression.
  2. Inside the white space of the if block, add an is expression of face () () block. happy is the default option so you don’t need to change anything.If the detected expression is happy, then Quarky must also be happy!
  3. Go to the Display palette and drop a display () expression block inside the if block. happy is the default option so you don’t need to change anything here as well.
  4. Repeat steps 2 and 3 for sadsurprised, and angry expressions.

Click the green flag to run the script and have fun!

Face-Expression-Mimic (1)

Table of Contents