Skip to main content

Now that you have created the 'Lab 8- Sort Colors' project, you will code the arm to pick up the red disk from the pick up location, determine the color using the Optical Sensor, and then drop the disk into the red drop off location.

In VEXcode V5, enter the coordinates for Point 1 and Point 2 into the [Joint move] blocks to create the stack of blocks shown in this image. 

These blocks will code the arm pick up the disk from the pick up location.

Use your coordinates for Point 1 and Point 2, and not the ones shown in this image.

Point 1 and Point 2 Callout

Follow the steps in this video to add a [Joint move] block, a [Wait] block, and to enter the coordinates for Point 3. 

These blocks will code the arm to hold the disk over the Optical Sensor for one second in order for the sensor to determine the color of the disk.

Use your coordinates for Point 3, and not the ones shown in this video.

Add a [Joint move], [Wait], and [Energize electromagnet] block to the project. Then, enter the coordinates for Point 4 into the [Joint move] block and set the [Energize electromagnet] block to 'drop,' to create the code snippet shown in this image. 

These blocks will code the arm to drop the disk into the red drop off location.

Use your coordinates for Point 4, and not the ones shown in this image.

Point 4 Callout

Place the red disk into the pick up location and then download and run the project.

Red disk in pick upDownload and run

Press the Brain's screen to trigger the arm's movement. The arm will pick up the red disk from the pick up location and hold it over the Optical Sensor for the sensor to determine that the color is red. Then, because the Optical Sensor is detecting a red disk, the arm will move to the red drop off location and sort the disk by dropping it into the standoffs. 

If your arm did not sort the red disk, notify your teacher. 

Step 6

Once you have finished coding the arm to pick up and sort the red disk using the Optical Sensor, stop the project.

stop