Knowledge Box
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:
- Open PictoBlox App, go to My Space, and click on the + button to create a new file.
- Connect Quarky to PictoBlox.
- You have to make Quarky turn 90° left. The trick is to adjust the time.
- You have to check for the following situations:
- Overshoot: Your time is more. Decrease its value.
- Undershoot: Your time is less. Increase its value.
- 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.
- 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.
- 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.
- Add both the go () at () % speed for () second blocks inside the repeat ()
- Complete the script by adding a when flag clicked block at the top.
- Now, run the script by clicking the green flag!
- Save the file as Square Robot.
Activity 1: Output
Challenge
Make a triangle shape using the robot.
Activity 2: Moving in a Circle
Now, it’s time to have some fun with the robot! 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:
- Open PictoBlox App, go to My Space and click on the + button to create a new file.
- Connect Quarky to PictoBlox.
- To implement this concept, we have to control the individual motors.
- 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.
- Try to make a clockwise rotating robot as well.
Activity 2: Output
Make sure you finish and submit the assignment, as well as take the quiz, before moving on to the next lesson.