Back to Course

Class 6 - Coding, AI & Robotics Course

0% Complete
0/0 Steps
  1. Coding

    Session 1: Introduction to Coding
    3 Topics
  2. Session 2: Backdrop, Costume, and Animation
    3 Topics
    |
    1 Quiz
  3. Session 3: Basics of Algorithm and Flowchart
    3 Topics
    |
    1 Quiz
  4. Session 4: Basics of Pseudocode
    3 Topics
    |
    1 Quiz
  5. Session 5: Getting Started with Quarky
    3 Topics
    |
    1 Quiz
  6. Session 6: Variables: The Multitaskers
    4 Topics
    |
    1 Quiz
  7. Session 7: Arithmetic Operators
    4 Topics
    |
    1 Quiz
  8. Session 8: Conditional Statements
    3 Topics
    |
    1 Quiz
  9. Session 9: Logical Operators
    4 Topics
    |
    1 Quiz
  10. Session 10: Nested Conditional Statements
    2 Topics
    |
    1 Quiz
  11. Session 11: Loops
    3 Topics
    |
    1 Quiz
  12. Session 12: Touch Based Piano
    2 Topics
  13. Session 13: Criterial in Loops
    5 Topics
    |
    1 Quiz
  14. Session 14: Catch the Fruit Game - Part 1
    2 Topics
  15. Session 15: Catch the Fruit Game - Part 2
    2 Topics
    |
    1 Quiz
  16. Artificial Intelligence
    Section 16: Introduction to Artificial Intelligence
    3 Topics
    |
    1 Quiz
  17. Session 17: Basics of Face Detection
    2 Topics
    |
    1 Quiz
  18. Session 18: Face Expression Detection
    2 Topics
    |
    1 Quiz
  19. Session 19: Mimic Face with Quarky
    1 Topic
  20. Session 20: Face Filter - Part 1
    2 Topics
  21. Session 21: Face Filter - Part 2
    2 Topics
  22. Robotics
    Session 22: Basics of Robotics
    2 Topics
    |
    1 Quiz
  23. Session 23: Wirelessly Controlled Robot
    2 Topics
  24. Session 24: Introduction to Sensors
    3 Topics
    |
    1 Quiz
  25. Session 25: Introduction to Actuators
    3 Topics
    |
    1 Quiz
  26. Session 26: Face Tracking with Robot
    2 Topics
  27. Session 27: Obstacle Avoidance Robot - Part 1
    3 Topics
  28. Session 28: Obstacle Avoidance Robot - Part 2
    2 Topics
    |
    1 Quiz
  29. Session 29: Edge Detector Robot - Part 1
    3 Topics
  30. Session 30: Edge Detector Robot - Part 2
    2 Topics
    |
    1 Quiz
  31. Capstone Project
    Capstone Project
Lesson Progress
0% Complete

Let’s Code

Follow the steps below:

  1. Create a New file in PictoBlox:
    1. Follow the step if you are working on Windows, macOS, or Linux:
      1. Open PictoBlox and create a new file.
      2. Select the coding environment as Block Coding.
    2. Follow the step if you are working on Android or iPhone:
      1. Open PictoBlox App and select My Space Tab from the home screen.
      2. Click on + sign to create a new file.
        The new file should be created like this.
  2. Open the Events palette and drag and drop the when flag clicked block into the scripting area. The when flag clicked block is a special type of block called hat block. It is used to start a script. Using this particular hat block you can run the script by clicking on the green flag above the stage.
  3. Next, open the Control palette and drag and drop the forever block below the when flag clicked block. forever block
    This block is used when you want a set of blocks to keep running until the script is stopped manually.
  4. Then, open the Motion palette and drag and drop the move () steps inside the forever block. move steps block
    This block is used to move the sprite by a specified number of steps. In our case, it is 10.move steps block
  5. Next, open the Control palette and drag and drop the wait () seconds block below the move () steps block and change the delay value to 0.1 seconds. The wait block is used to pause/delay the script execution by the specified time.wait block
  6. Run the script by clicking the green flag. What just happened? Where did Tobi go?! As it seems, he went out of the frame. Let’s fix this so that the Tobi doesn’t wander off again.
  7. Open the Motion palette and drag and drop the when on edge, bounce block inside the forever block. if on edge bounce block
    This block detects whether the sprite has touched the edge of the stage or not and change the direction if it has.if on edge bounce block
  8. Run the script by clicking the green flag. What is happening to Tobi Now? Is he upside-down? To stop this, you must change the rotation style.
  9. Go to the Motion palette and drag and drop the set rotation style () below the when flag clicked block and select left-right from the drop-down. set rotation style block
  10. The script is now complete! Run it by clicking the green flag. Making tobi moveYay! You’ve just completed your first script! Pat yourself on the back. Tobi Moving

Saving the Program

  1. To save the program, click on File > Save As.
  2. A window will popup. Choose the location as Desktop or any other relevant folder. Name the file Tobi Walking.

  3. Click on Save.

The file is saved with a .sb3 extension on your computer.

Assignment

Before you move on to the next lesson, a small assignment awaits you!

You must upload the PictoBlox program you created in this activity to the website. Submitting the assignment is a must in order to receive the certificate after completing the course.

Follow the steps below to upload your assignment:

  1. Click on Browse.
  2. Search and Select your saved Project file(.sb3) and Click Open.
  3. Click on Upload to submit the assignment.
evive Alert
The file type allowed is the SB3 file generated from the PictoBlox program. The maximum file size allowed is 5 MB.

Good luck!