Lesson 23 – Make shapes with Robot

Lesson Description

In this lesson, you will program a robot to draw various shapes using a repeat loop. The shapes you will program the robot to draw are a square, a triangle, and a circle.

INTRODUCTION

In the Robot palette, you will find a block named go () at () % speed for () seconds. Using this block, you can make the entire robot move forward, backward, left, or right instead of using blocks for individual motors every single time.

ACTIVITY 1: MAKING A SQUARE

Now, it’s time to have some fun with the robot! Let’s make Quarky draw a square.

CODING STEPS

Follow the steps below:

  1. Create a New file in PictoBlox App.
  2. Connect Quarky to PictoBlox.
  3. You have to make Quarky turn 90° left. The trick is to adjust the time.
  4. You have to check for the following situations:
    1. Overshoot: Your time is more. Decrease its value.
    2. Undershoot: Your time is less. Increase its value.
  5. Go to the Robot palette and add a go () at () % speed for () second The forward direction of motion, 100% speed, and 1 second are set as the default values.
  6. Then, add another go () at () % speed for () second block and change the direction to left. Remember the 90° left exercise we did above? You must use the same turning time you got during that exercise. Until now, we’ve made Quarky move forward and turn left just once. To make a square, it must repeat these steps three more times.
  7. Add a repeat () block from the Control palette and write 4 in the space. This means that all the blocks inside the repeat () block will run 4 times.
  8. Add both the go () at () % speed for () second blocks inside the repeat ()
  9. Complete the script by adding a when flag clicked block at the top.
  10. Now, run the script by clicking the green flag! The robot should make a Square.
  11. Save the file as Robot Square.

CHALLENGE

Make a triangle shape using the robot.

ACTIVITY 2: MOVING IN A CIRCLE

Let’s make Quarky draw a circle.

Till now we were only focusing on the direction of the motors to move the robot. But when we have to make the robot move in a circle, we have to consider the speed at which both the wheels are moving. For example, to make the robot move in a circle in the anti-clockwise direction, we have to maintain the following conditions:

  • Both the wheels are moving in the forward direction.
  • The left wheel speed should be less than the right wheel speed.

CODING STEPS

Follow the steps below:

  1. Create a New file in PictoBlox App.
  2. Connect Quarky to PictoBlox.
  3. To implement this concept, we have to control the individual motors.
  4. To control the radius of the circle, the motor speed needs to be changed. If the difference between the motor speed is high the radius will be smaller and if the difference is less, the radius will be larger.
  5. Try to make a clockwise rotating robot as well.

 

 

Table of Contents