Lesson 1, Topic 1
In Progress

Activity 1: Classifying the Waste

Set the Environment

  1. Open the PictoBlox.
  2. Select Block Coding as your coding environment, ignore if already selected.

Adding Up the Extension

As you know, we are making a script to recognize the objects  so let’s add Object Detection extension.

  1. Click on the add extension button from the bottom left corner.
  2. Once clicked you will be able to see all the extensions available
  3. Select Object Detection

Writing the Script in PictoBlox

To do this activity we need to create two different list of material. 

  1. Biodegradable Objects – banana, apple, book, pizza
  2. Non-Biodegradable Objects –  bottle, pen scissor, clock

Create blocks:

Start the activity by creating two blocks.

Go to my block palette and click on make a block.

Create a block named Biodegradable Objects.

Similarly make another block named Nonbiodegradable Objects.

After creating a block one can observe that there will be two defined blocks that will appear in the scripting area.

Next, we will create the list of material below these categories. 

Create List:

Go to my variable palette and click on make a list.

Rename the list as Bio.

Similarly, create another list as Non-Bio. 

You can observe new functions will get appear on the palate section. 

we can also observe the list section will appear on the stage area.

Next, we will add a list of things below the Define blocks.

 

Biodegradable Object list:

  1. Snap delete all of() block below define biodegradable Objects. Select Bio from the drop-down. 
  2. Get Add () to () block place below delete all of(), select Bio from the drop-down. Add first object banana.
  3. Similarly, we can add multiple add () to () blocks to add different objects such as apple, book, pizza.

Non-Biodegradable Object list:

  1. Snap delete all of() block below define biodegradable Objects. Select Non-Bio from the drop-down. 
  2. Get Add () to () block place below delete all of(), select Non-Bio from the drop-down. Add first object Bottle.
  3. Similarly, we can add multiple add () to () blocks to add different objects such as pen, scissors, clock.

List of object will appear on the stage.

Main Script:

  1. Get when flag clicked block from the control palette.
  2. Snap Biodegradable Objects Block from block palette below when flag clicked.
  3. Similarly, Snap Non Biodegradable Objects Block from block palette below Biodegradable Objects.
  4. Get ask () and wait block from sensor palette. And add “Enter the waste” in the question.
  5. Snap if () then else block from the control palette.
  6. Get () contains () ? block from Lists palette and place in the if block. Drop down and set it to Bio. Place answer block in the contains space.
  7. Next, get say() block and set message as “Biodegradable Waste” in the if arm.
  8. Snap if () then else block from the control palette place it in the else block.
  9. Get () contains () ? block from Lists palette and place in the if block. Drop down and set it to Non Bio. Place answer block in the contains space.
  10. Next, get say() block and set message as “Non Biodegradable Waste” in the if arm.
  11. Place, say () block in the else arm. Put massage as ” Unidentified Waste”.

Code is completed!!

Testing

When we will click on the green flag It will ask a question ” Enter the waste”. Enter the name of the waste if the waste is of the Biodegradable list. Toby will detect Biodegradable Objects. And if the waste is of the Non Biodegradable list. Toby will detect Non Biodegradable Objects. Otherwise it will say Unidentified Object.

 

Get in Touch!