Programming Drive Forward and Reverse - Blocks-based
Teacher Toolbox - Activity Outline
-
This exploration will introduce students to basic drive forward, in reverse, and waiting programming behaviors.
-
Using the V5 Speedbot (Drivetrain 2-motors, No Gyro) template project enables the students to program the Speedbot to move forward by just selecting the [Drive for] block.
The Speedbot is ready to move!
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:
- To find out more information about the block, open the Help and then select the [Drive for] block.
- Make sure you have the hardware required, your engineering notebook, and VEXcode V5 downloaded and ready.
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.
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:
-
Are the motors plugged into the correct ports?
-
Are the smart cables fully inserted into all of the motors?
-
Is the Brain turned on?
-
Is the battery charged?
Teacher Tips
Model each of the troubleshooting steps for the students.
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.
Complete the following steps:
- Open the File menu.
- Select Open Examples.
- Select and open the Speedbot (Drivetrain 2-motors, No Gyro) template project.
- Since we will be using the drive for block, rename your project Drive.
- Save your project.
- Check to make sure the project name Drive is now in the window in the center of the toolbar.
Teacher Tips
-
Since this is a beginning activity with programming, the teacher should model the steps, and then ask the students 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 Open 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.
Teacher Toolbox - Saving Projects
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 was renamed Drive and saved, the display updated 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 just following a few simple steps, they will be able to create and run a project that will move the Speedbot forward.
Teacher Toolbox - Stop and Discuss
This is a good point to pause and have the students review the steps that were just completed on starting a new project in VEXcode V5 individually or in groups. Ask the students to reflect individually before sharing within their group or to the whole class.
Step 3: Drive Forward
- Add the [Drive for] block to the {When started} block in the programming area.
- Select the drop-down and change the units from inches to millimeters.
- Change the distance from 1 mm to 100 mm.
- 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.
- Connect the robot to your computer or tablet. The Brain icon in the toolbar turns green once a successful connection has been made.
- Click the Download button on the toolbar to download the Drive project to the Robot Brain.
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 [Drive 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 - Stop and Discuss
Ask the students to predict what they think will happen when this project is downloaded and run on the Speedbot. Tell the students to record their predictions in their engineering notebooks. If time allows, ask each group to share their prediction.
- 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 - 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.
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 on the Robot Brain. Congratulations on creating your first project!
Step 4: Drive Reverse
Teacher Toolbox - Completing Step 4
-
To change the [Drive for] block from forward to reverse, simply click on the drop-down menu and select reverse.
-
The number of mm can be changed, but for this example we will leave them at 100 mm as set in the previous step.
-
If the students are using a computer, ask 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 Drive in Reverse
- Add a [Wait] block before the [Drive for] block. This will tell the robot to wait before driving in reverse.
- Insert three seconds into the [Wait] block. This tells the robot to wait three before driving in reverse.
- 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 - 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, ask 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 6: Complete the Basketball Drills Challenge!
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
Teacher Tips
Validate that the robot successfully completed the challenge by using a meter stick or ruler and tape to mark a starting position for the robot. Then mark 10 mm, 20 mm, and 40 mm from that starting position as a reference to where the robot needs to move in order to complete the challenge.
Teacher Toolbox - Stop and Discuss
Ask the students to share their solutions in pairs before discussing them as a whole class. Facilitate the discussion by asking:
-
Did you face any difficulties while programming this challenge?
-
Did your robot behave like you expected based on your project? Why or why not?
-
If you could do the challenge over, is there anything that you would have done differently?