ACTIVITY: Control Your Robot Wirelessly

You gave Quarky some cool moves there! But you don’t know how to control it as of yet. In this topic, you’ll learn how to do that. So, let’s get started!

Understanding the Logic

We’re going to control Quarky wirelessly using the arrow keys of the keyboard of your desktop/in the PictoBlox mobile app.

Here’s how:

  1. Using the up arrow key, we will make Quarky move forward.
  2. Using the down arrow key, we will make it move backward.
  3. Using the right arrow key, it will move right.
  4. Using the left arrow key, it will move left.
  5. When none of the arrow keys is pressed, Quarky should stop moving.

Now, let’s put our plan into action!

Let’s Code

  1. First, power up the Quarky and connect it to PictoBlox as shown in the previous topic.
  2. We want to ensure that Quarky moves forward only if the up arrow key is pressed. To check if it is pressed, we’re going to use an if block. Go to the Control palette and drag and drop an if-else block.
    if () then else
  3. Now, go to the Sensing palette and add a key () pressed? block inside the diamond-shaped space of the if block. This block will check if the selected key is pressed. The up arrow key is the default option.

    If the up arrow key is pressed, we want Quarky to move forward. Therefore we will now add a go () at () % speed for the () second block.

  4. Go to the Robot palette and add a go () at () % speed for () second block inside the if block.

    Now, we need to do the same for the remaining three directions.

  5. Duplicate these blocks by right-clicking the if-else block. Then, in the key () pressed ? block, change the key to down and in the go () at () % speed for () second block, change the direction to backward.
  6. Repeat step 6 two more times for the remaining two directions.
  7. Now put the stop robot block in the last else branch.
  8. Complete the script by adding a forever & when flag clicked blocks at the top.

Now, run the script by clicking the green flag. Have fun playing with Quarky! 🙂


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

Make a video of the project you made in this activity and upload it 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. First, you need to choose the video file, thus click on Browse.
  2. Select your video file.
  3. And click the Upload button.

Good luck!