Skip to main content
Teacher Portal

Programming Turning Right and Left - Blocks-based

Teacher Toolbox icon Teacher Toolbox - Activity Outline

  • This exploration will introduce students to basic turning right, left, and waiting programming behaviors.

  • Using the drivetrain robot configuration enables the students to program the Speedbot to turn by just selecting the [Turn for] block.

Speedbot is ready to turn!

This exploration will give you the tools to be able to start creating some cool projects for your Speedbot to follow.

  • VEXcode V5  that will be used in this exploration:

VEXcode IQ Turn for block set to turn right for 90 degrees.

  • To find out more information about the block, open the Help and then select the [Turn for] block.

Help in VEXcode open showing the Help for the Turn for block. The Help icon in the upper right corner is highlighted, illustrating what to select to open the Help Menu for a block.

  • Make sure you have the hardware required, your engineering notebook, and VEXcode V5 downloaded and ready.

Teacher Tips icon Teacher Tips

If this is the student’s first time using VEXcode V5, they can reference the Tutorials at any time during this exploration. The Tutorials are located in the toolbar.

VEXcode V5 Toolbar with the Tutorials button called out in a red box, to the right of the File menu.

Materials Required:
Quantity Materials Needed
1

Speedbot Robot

1

Charged Robot Battery

1

VEXcode V5

1

USB Cable (if using a computer)

1

Engineering Notebook

Teacher Tips icon Teacher Tips

  • Model each of the steps for checking that the Speedbot is ready so that students will get into the habit of doing so.

Step 1: Preparing for the Exploration

Before you begin the activity, do you have each of these items ready? Check each of the following:

Step 2: Start a New Project

Before you begin your project, select the Speedbot (Drivetrain 2-motors, No Gyro) - Template project. The template project contains the Speedbot's motor configuration. If the template is not used, your robot will not run the project correctly.

VEXcode V5 Toolbar with the File menu open and Open Examples highlighted in a red box. Open Examples is the fourth menu item beneath New Blocks Project, New Text Project, and Open.

Complete the following steps to open the template project:

  • Open the File menu.
  • Select Open Examples.

SpeedBot (Drivetrain two motors, No Gyro) template icon, illustrating which template project to select for this activity.

  • Select and open the Speedbot (Drivetrain 2-motors, No Gyro) template project.
  • Since we will be using the [Turn for] block, rename your project Turn.
  • Save your project.
  • Check to make sure the project name Turn is now in the window in the center of the toolbar.

    VEXcode V5 Toolbar displaying the project name 'Turn', illustrating which menu should be used to change the project's name.

Teacher Toolbox icon Teacher Toolbox - Saving Projects

VEXcode V5 Toolbar displaying the default project name 'VEXcode Project' to right of the Slot button.

Point out that when they first opened VEXcode V5, the window was labeled VEXcode Project and it was not saved (indicated on the toolbar). VEXcode Project is the default project name when VEXcode V5 is first opened. Once the project is renamed Turn and saved, the display updates to Saved. Using this window in the toolbar, it is easy to check that the students are using the correct project and it is saved. Once a project is initially saved, VEXcode V5 autosaves any subsequent changes, as indicated by the message next to the project name.

Tell the students that they are now ready to begin their first project. Explain to the students that by following a few simple steps, they will be able to create and run a project that will turn the Speedbot.

Teacher Tips icon Teacher Tips

  • Since this is a beginning activity with programming, the teacher should model the steps, and then ask the students to complete the same actions. The teacher should then monitor the students to ensure that they are following the steps correctly.

  • Make sure that the students have selected Open Examples from the File menu.

  • Make sure that the students have selected the Speedbot (Drivetrain 2-motors, No Gyro) template project.

    You can point out to the students that there are several selections to pick from on the Examples page. As they build and use other robots, they will have a chance to use different templates.

  • You can ask students to add their initials or the name of their group to the project name. This will help differentiate the projects if you ask the students to submit them.

Step 3: Turn Right

VEXcode IQ project starting with a When Started block followed by a Turn for block set to 'turn right for ninety degrees'.

  • Add the [Turn for] block to the {When started} block in the programming area.

VEXcode V5 Toolbar with the Slot menu opened to the left of the project name. The dropdown menu lists all of the available slots, from one to eight. The first slot is called out with a red arrow.

  • Click on the Slot icon. You can download your project to one of the four available slots in the Robot Brain. Click on the number 1.

VEXcode V5 Toolbar with a red box around the green Brain icon, in between the Controller and Download buttons.

  • Connect the robot to your computer or tablet. The Brain icon in the toolbar turns green once a successful connection has been made.

VEXcode V5 Toolbar with a red box around the download icon, in between the Brain and Run buttons.

  • Click the Download button on the toolbar to download the Turn project to the Robot Brain.

Teacher Toolbox icon Teacher Toolbox - Help with Blocks

  • Point out that in the programming area, there is already a {When started} block located there by default. Every project will begin with this block. When the project is started the connected blocks will be followed in the sequence in which they are placed.

    Demonstrate clicking on the [Turn for] block and dragging it to the programming area, connecting it to the {When started} block. You will hear a click when as it attaches.

  • If you are using a computer, the student should have VEX V5 Robot Brain connected to the computer using a USB cable. If you are using a tablet, the VEX V5 Robot Brain should be connected to the tablet using the Smart Radio.

  • If the students are using a computer, ask them now to disconnect the USB cable from the Robot Brain. Having the robot connected to a computer while running a project could cause the robot to pull on the connection cable.

Teacher Toolbox icon Teacher Toolbox - Stop and Discuss

This is a good point to pause and have the student reflect on running their first project. As students:

  • What did Speedbot do when you ran the project?

  • Did it behave as you would expect it to, based on the project?

Take a moment to make sure all students have completed this step without any issues before moving on.

V5 Brain screen reads Home at the top. Turn is listed as the project in slot 1, beneath the Drive settings button. The program icon must be pressed to select the project.

  • Check to make sure your project has downloaded to the Speedbot's Brain by looking at the Robot Brain’s screen. The project name should be listed in slot 1.

Teacher Toolbox icon Teacher Toolbox - Model First

Model running the project in front of the class before having all the students try at once. Gather the students in one area and leave enough room for the Speedbot to move if it is placed on the floor. Since the Speedbot will continue running the project until the back button on the Robot Brain is pressed, the teacher may want to choose someone to assist in stopping the Speedbot's project when it finishes.

Tell the students it is now their turn to run their project. Make sure that they have a clear path and that no Speedbots will run into each other.

  • Run the project on the Speedbot robot by making sure the project is selected and then press the Run button.

Step 4: Turn Left

The dropdown menu on the VEXcode Turn for block, showing how to change the block's direction parameter from right to left.

  • Change the [Turn for] to display left instead of right.
  • Download the project.
  • Run the project on the Speedbot robot by making sure the project is selected and then press the Run button.

Teacher Toolbox icon Teacher Toolbox - Completing Step 4

  • To change the [Turn for] block from right to left, simply click on the dropdown menu and select left.

  • If the students are using a computer, remind them to disconnect the USB cable from Robot Brain before running the project.

    Because we are not selecting a new slot, the new project will download to slot 1 and replace the previous project.

  • Since VEXcode V5 has autosave, there is no need to save the project again.

Step 5:  Wait, then Turn Left

 

VEXcode V5 project beginning with a When Started block. Next is a Wait block with a time parameter of three seconds, lastly is the Turn For block set to turn left for ninety degrees.

  • Add a [Wait] block before the [Turn for] block. This will tell the robot to wait before turning left.
  • Insert three seconds into the [Wait] block. This tells the robot to wait three before turning.
  • Download the project.
  • Run the project on the Speedbot robot by making sure the project is selected and then press the Run button.

Teacher Toolbox icon Teacher Toolbox - Completing Step 5

  • A [Wait] block can be placed anywhere in the project. For more information on the [Wait] block, open the Help.

  • Using a [Wait] block will not end the project.

  • If the students are using a computer, remind them to disconnect the USB cable from Robot Brain before running the project.

  • Since VEXcode V5 has autosave, there is no need to save the project again.

Motivate Discussion icon Motivate Discussion - Understanding the Blocks

Q: Viewing the robot's current position at zero degrees, If the robot turned left 90 degrees, then turned right 120 degrees, and finished by turning left 40 degrees, how many degrees would the robot currently be at after it finished turning?
A: The robot will be at 10 degrees. After turning left 90 degrees, the robot turned right 120 degrees. Viewing turning left as moving in a positive direction and turning right as subtracting or moving in a negative direction - similar to an x-y coordinate plane, this now puts the robot at -30 degrees. Since 90-120 = -30. From -30 degrees, the robot turns left 40 degrees. Thus, -30 + 40 = 10. The robot ends at 10 degrees.

Q: Viewing the robot's current position at zero degrees, turning the robot 30 degrees to the right will have the robot finish in the same spot as starting from zero degrees and turning the robot 330 degrees to the left. If the robot turned right 56 degrees and, how many degrees to the left will the robot have to turn to end in the same place assuming it starts from zero degrees?
A: Since turning the robot around fully is 360 degrees, you can add and subtract from 360 degrees to calculate how the robot will need to turn. 360 - 56 = 304. Thus, the robot will have to turn 304 degrees to the left to end in the same place as turning 56 degrees to the right.

Step 6: Complete the Security Camera Challenge!

A SpeedBot with three circles drawn around it, indicating directions for turning. Three movements are shown and labeled, first turning to the right, then the left, then the right and repeating the left to right steps three times.
Security Camera Challenge Layout

In the Security Camera Challenge, the robot must start by turning to the right 90 degrees. The robot will then turn to the left 180 degrees then right 180 degrees “scanning” just like a security camera. The robot will then repeat turning 180 degrees to the left and 180 degrees to the right an additional two more times. Thus, the robot will scan 180 degrees three times total.

Before programming the robot, plan out the robot's path and behaviors in your engineering notebook.

After completing the Security Camera Challenge, you will be able to combine forward and backwards movements with additional robot behaviors to complete even more advanced challenges.

Teacher Toolbox icon Teacher Toolbox - Solutions

- View the sample solution below.

- A programming rubric to evaluate students can be found here (Google / .docx / .pdf ).

VEXcode V5 project beginning with a When Started block with a Turn for block set to right for 90 degrees attached. There are then six Turn for blocks attached, alternating between turning left and right for 180 degrees.

For a more advanced solution, a student can also be introduced to loops by using the [Repeat] block. For more information about the [Repeat] block, view the Help.

VEXcode V5 project beginning with a When started block attached to a Turn for block set to turn right for 90 degrees. There is then a Repeat block set to repeat 3 times. Inside the repeat block are two Turn for blocks, a turn left for 180 degrees block followed by a turn right for 180 degrees block.

Teacher Tips icon Teacher Tips

Validate that the robot successfully completed the challenge by watching the robot's starting position, and count to ensure that the robot has performed the correct actions. The robot should turn right for 90 degrees, then repeat three times: a turn left for 180 degrees and a turn right for 180 degrees.