GETTING STARTED
ROBOTICS
TAKING LEARNING TO THE REAL WORLD
CAPSTONE PROJECT

ACTIVITY: Make Your Robot Move

Time to give Quarky some moves! Let’s have a look at how to make Quarky move forward, backward, right, and left.

Connecting Quarky to PictoBlox

Let’s begin by first connecting Quarky to PictoBlox. Select your preferred type of device and follow the instructions.

Desktop

To work with Quarky, you can connect Quarky to PictoBlox in two ways:

  1. Using USB-C Cable.
  2. Using Bluetooth. To work with Bluetooth in PictoBlox, you need to first download and install the Scratch link, which you can download from here.

Follow the steps below for connecting Quarky to PictoBlox using Bluetooth:

  1. First, power On your Quarky.
  2. Start the Scratch Link.
  3. Open PictoBlox on your desktop.
  4. Then, click the Board button in the toolbar and select board as Quarky.
  5. Next, click the Connect button. We will connect Quarky to PictoBlox using Bluetooth, thus from the dialog box that appears, click on Bluetooth Ports and then select the appropriate port from the list to connect Quarky.

And voila! Quarky is now connected to PictoBlox.

Mobile

Follow the steps below for connecting Quarky to PictoBlox:

  1. First, power ON Quarky.
  2. Open PictoBlox on your smartphone. Go to My Space and make a new project by clicking the ‘+(plus)’ button in the bottom-right corner.
    PictoBlox in Mobile Phone
  3. Then, tap the Board button in the top-right corner of the toolbar.PictoBlox Board
  4. Select board as Quarky.
  5. Next, tap the Connect button.PictoBlox Connect
  6. Select the name of your Bluetooth module from the list.

And voila! Quarky is now connected to PictoBlox. Now, let’s make a script in PictoBlox to display expressions on Quarky’s matrix!

Understanding the Logic

Before we begin with our script, we first need to understand HOW to make Quarky move.

If both the wheels of the robot rotate in the forward direction, then it will move forward. Makes sense, right?

Robot Forward

Similarly, if both the wheels rotate in the backward direction, the robot will move backward.

Robot Backward

Making the robot turn left and right is the tricky part. To make Quarky turn left, its right wheel should rotate in the forward direction but its left wheel should rotate in the backward direction.

Left Robot

On the other hand, to make Quarky turn right, its left wheel should rotate in the forward direction and the right wheel should rotate in the backward direction.

Right Robot

Now let’s try this in PictoBlox!

Let’s Code

Forward Movement

Let’s make the script for the robot to run the robot forward for 1 second and then stop.

Robot Forward

Follow the steps below to make the script for moving Quarky:

  1. First, go to the Robot palette and add the run () motor () with () speed block. The left motor, the forward direction of motion, and 100% speed are set as the default values.
  2. Now, copy the run () motor () with () speed block and add it below the first one. Select the right motor from the dropdown.
  3. Next, add a wait () seconds block from the Control palette and set the waiting time as 1 second.
  4. Drag and drop the when flag clicked block into the scripting area from the Events palette.
  5. Next, add a stop () motor block from the Robot palette below wait () seconds block and select left as the option.
  6. Next, add another stop () motor block from the Robot palette and select right as the option.

Now, run the script by clicking the green flag. And your robot’s ready to rock ‘n’ roll!

Backward Movement

Let’s convert the above script to make the robot run backward for 1 second and then stop.

  1. Change the direction in the first run () motor () with () speed block to backward. This will make the left motor go backward.
  2. Change the direction in the second run () motor () with () speed block to backward. This will make the right motor go backwards.

The script will look like this: 

Robot Backward

And your robot will run like this:

Robot Backward

Left Movement

Let’s convert the above the script to make the robot to run the left for 1 second and then stop.

  1. Change the direction in the first run () motor () with () speed block to backward. This will make the left motor go backward.
  2. Change the direction in the second run () motor () with () speed block to forward. This will make the right motor go forward.

The script will look like this: 

And your robot will run like this:

Left Robot

There is another way you can run the robot left:

  1. Delete the first run () motor () with () speed block. Deleting this block will keep the left motor at rest throughout the motion.
  2. Change the direction in the second run () motor () with () speed block to forward. This will make the right motor go forward.

The script will look like this: 

And your robot will run like this:

Turn Left Robot 2

With this script, the robot is turning left on the left wheel.

Right Movement

Let’s convert the above the script to make the robot to run the right for 1 second and then stop.

  1. Change the direction in the first run () motor () with () speed block to forward. This will make the left motor go forward.
  2. Change the direction in the second run () motor () with () speed block to backward. This will make the right motor go backward.

The script will look like this: 

And your robot will run like this:

Right Robot

There is another way you can run the robot left:

  1. Change the direction in the first run () motor () with () speed block option to forward. This will make the left motor go forward.
  2. Delete the second run () motor () with () speed block. Deleting this block will keep the right motor at rest throughout the motion.

The script will look like this: 

And your robot will run like this:

Turn Right Robot 2

With this script, the robot is turning right on the right wheel.

Shh! It’s a Secret.

Time to share a little tip with you!

As you can see from the script above, we had to use blocks for each motor separately to make Quarky move. But what if we want it to do much more than just moving, such as recognizing objects, collecting different items, etc? In that case, the script would become huge and difficult to keep track of.

But don’t you worry! We have a solution for it. 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. So, let’s rewrite our script using this block.

All you have to do is replace both run () motor () with () speed blocks for each type of movement with one go () at () % speed for () second block. And you’re done! Pretty cool, huh? 😉

Try changing the parameters and run the motor in different ways.

Time to Explore!

Now, it’s your turn to try something out. You have to make Quarky turn 90° left.

90 Degree Right Turn Correct

The trick is to adjust the time.

evive Notes Icon
The time will be different for everyone. So, don’t worry if you don’t get the same as ours.

  1. Overshoot: Your time is more. Decrease its value.
    90 Degree Right Turn Overshoot
  2. Undershoot: Your time is less. Increase its value.
    90 Degree Right Turn Undershoot

Playing with the Robot

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

Make a Square

  1. Go to the Robot palette and add a go () at () % speed for () second block. The forward direction of motion, 100% speed, and 1 second are set as the default values.
  2. 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.

  3. 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.
  4. Add both the go () at () % speed for () second blocks inside the repeat () block.
  5. Complete the script by adding a when flag clicked block at the top.
  6. Now, run the script by clicking the green flag!

×
×

Cart