Skip to main content

The Speedbot is ready to move! 

This exploration will give you the tools to be able to program your Speedbot for simple movements. At the end of this activity, you will engage in the Basketball Drills Challenge using forward, reverse, and waiting behaviors.

  • VEXcode V5 Python instructions that will be used in this exploration:
    • drivetrain.drive_for(FORWARD, 200, MM)
    • wait(1, seconds)
  • To find out more information about the instruction, select Help and then select the question mark icon next to a command to see more information.

    Image of the VEXcode V5 Workspace with help notes open for the Drivetrain drive forward command

     

  • Make sure you have the hardware required, your engineering notebook, and VEXcode V5 downloaded and ready.
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

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

Complete the following steps to begin the project:

  • Open the File menu and select Open Examples.

    Image showing the File menu open in VEXcode V5 showing the Open Examples option

     

  • Select and open the Speedbot (Drivetrain 2-motor, 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.

    Image showing the Example projects with a red box around the Clawbot (Drivetrain 2-motor, No Gyro) Template Project

     

  • Since you will be working on moving the Speedbot forward and reverse, you will name your project Drive. Select the Project Name, Type in 'Drive' and then select 'Save.'Image of the project title renamed to
  • Check to make sure the project name Drive is now in the window in the center of the toolbar.

    Image of the project name changed to Drive in VEXcode V5

     

Step 3:  Drive Forward

You are now ready to begin programming the robot to drive forward!

  • Before we begin programming, we need to understand what an instruction is. There are three parts to an instruction. For more information on the colorization of code in VEXcode V5 Python, view this article.

    A screenshot of a C++ code snippet in VEXcode, with annotations. The command, drivetrain.driveFor(FORWARD, 200, MM) is highlighted with red borders around drivetrain (labeled as Device); drive for (labeled as Command); and FORWARD, 200, MM (labeled as Parameters)

  • Add the instruction to the project:

    A screenshot of a Python code snippet in VEXcode showing library imports and the beginning of the project code. The command drivetrain.drive_for(REVERSE, 100, MM); is highlighted with a red border, indicating the robot is programmed to drive in reverse for 100 millimeters.

  • Select the Slot icon to choose one of the eight available slots on the Robot Brain and select slot 1.

    Image showing the Slots with a red box around Slot 1

     

  • Connect the V5 Robot Brain to the computer using a micro USB cable and power on the V5 Robot Brain. The Brain icon in the toolbar turns green once a successful connection has been made.

    Image of the VEXcode V5 Toolbar with a red box around the green Brain Icon

     

  • Select Download to download the project to the Brain.

    Image of the VEXcode V5 Toolbar with a red box around the Download icon

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

    Image showing the project displayed on the VEX V5 Brain Screen

  • Run (Python) the project on the robot by making sure the project is selected and then press the Run button on the Robot Brain. Congratulations on creating your first project!

    Image of the Run button on the VEXcode V5 Brain Screen

Step 4:  Drive Reverse

Now that you have programmed your robot to drive forward, let us program it to now drive in reverse.

  • Change the parameter in the drive_for instruction to display REVERSE instead of FORWARD.

    A screenshot of a Python code snippet in VEXcode showing library imports and the beginning of the project code. The command 'drivetrain.drive_for(REVERSE, 100, MM)' is highlighted with a red border, indicating the robot is programmed to drive in reverse for 100 millimeters

  • Select the Project Name to change it from Drive to Reverse.

    image showing the VEXcode V5 Toolbar, with the project name changed to

     

  • Select the Slot icon to choose a new slot. Select slot 2.

    Image showing the Slots with a red box around Slot 2

     

  • Download (in Python) the project.

    Image showing the VEXcode V5 Toolbar with a red box around the Download button

  • Check to make sure your project has downloaded (in Python) by looking at the Robot Brain’s screen. The project name Reverse should be listed in Slot 2.

    Image showing the Reverse project displayed on the V5 Brain Screen

  • Run (in Python) the project on the robot by making sure the project is selected and then press the Run button on the Robot Brain.

    Image showing the Run button on the V5 Brain Screen

Step 5:  Wait then Drive in Reverse

Now that we have programmed the robot to drive forward and then in reverse, we can now add a wait instruction so that the robot waits a certain amount of time before driving in reverse.

  • Add a wait instruction as shown. This tells the robot to wait three seconds before driving in reverse.

    A screenshot of a Python code snippet in VEXcode showing library imports and the beginning of the project code. The command wait(3, SECONDS) is highlighted with a red border, indicating the program will pause for 3 seconds before executing the next command, drivetrain.drive_for(REVERSE, 100, MM)

  • Select the Project Name to change it from Reverse to WaitReverse.

     

  • Select the Slot icon to choose a new slot. Select slot 3.

    Image of the slots with a red box around Slot 3

  • Download (in Python) the project.

    Image of the download button in the Toolbar of VEXcode V5

  • Check to make sure your project has downloaded (in Python) by looking at the Robot Brain’s screen. The project name WaitReverse should be listed in Slot 3.

    Image showing the project on the VEX V5 Brain Screen

  • Run (in Python) the project on the robot by making sure the project is selected and then press the Run button.

    Image showing the Run button on the VEX V5 Brain Screen

Step 6:  Complete the Basketball Drills Challenge!

A top-down view of the Basketball Drills Challenge showing a robot positioned at the starting line of a course. The course includes three black lines labeled 10 cm, 20 cm, and 40 cm, marking distances from the start
Basketball Drills Challenge layout

In the Basketball Drills Challenge, the robot must be able to navigate a series of lines at different distances. The robot will travel forward to the first line which is 10 cm from the starting position, wait 1 second, and then travel backwards returning to that same line. The robot will then repeat the action by driving forward 20 cm to the second line, wait 1 second, and then drive backward to the original starting line. The robot will drive forward to the third line with a distance of 40 cm, wait 1 second, and then finally return to the starting line to finish the challenge.

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

After completing the Basketball Challenge, you will be able to combine forward and reverse movements with additional robot behaviors to complete even more advanced challenges.
Keep in mind when programming that 1 cm = 10 mm.