Open Ended STEM Lab Exploration: Code
Step 1: Preparing to Code
Remember, you can always look to the tutorials for more information about blocks, sequences, and troubleshooting. Use the Help section when you want to know about what a specific block does or how to use it.
Using Blocks with Specificity
To move a specific distance, use the [Drive for] block, and change the direction and distance travelled by adjusting the parameters in the block.
To turn either right or left in any degree increment, use the [Turn for] block. Again, you can adjust the parameters to suit your design needs.
Open a New Project
The Programmer should start a new project with the Autopilot (Drivetrain) template, name, and save it. Since we will be creating a path for a recycle robot, rename your project “Recycle Run.”
For reminders on how to get started see the tutorials or refer to the example programs for reference.
Step 2: Create a List of Steps Using the Comment Blocks
What Are Comments?
Comments are usually added to projects to explain what a programmer wanted parts of the project to do. So they are helpful when collaborating and troubleshooting.
In this case, we are going to use them to help us make a general list of the steps the robot needs to do to complete its task.
What is the First Thing the Robot is Going To Do?
In the project, use the [comment] blocks to create a basic sequence in your group. The Recorder or Programmer should list the first 10 steps in VEXcode IQ, with a comment block for each step. See the example here.
The text in the block does not have to be as specific as the blocks themselves, as this is just a guide to follow when you begin to create the actual coding sequence.
Step 3: Create the Coding Sequence
Now, it’s time to translate those steps into a block sequence.
-
Your robot should begin the path facing forward, so drag and drop the [drive for] block and set the parameters to match the first step in your path.
-
Look for the next step, and drop the turn for block and set the parameters to match the next step in your path.
When you get into a room, add an indicator block (like [set Touch LED color] or [play sound]). Because the Autopilot cannot actually pick things up, the indicator represents the robot picking up the recycling before moving on. -
Keep dragging and dropping blocks and setting parameters until you have finished the path for your Recycle Robot.
Step 4: Preparing to Run Your Project
Before you run the project, do you have each of these items ready? The Builder should check each of the following:
- Are all the motors and sensors plugged into the correct port?
- Are the smart cables fully inserted into all the motors and sensors?
- Is the Brain turned on?
- Is the battery charged?
For a review of downloading and running your project, see the tutorials.
Step 5: Test Run your project
Now it is time to test out your project! Make sure your Autopilot robot is set up with enough space to be able to run the complete program without falling or bumping into another robot or team.
- The Operator should now run the first part of the project on the Autopilot robot by making sure the project is highlighted and then pressing the Check button.
- How did your test run go? Did your robot drive the path you thought it would? Follow the troubleshooting chart, and continue to create and check sections of code until you have a completed path.