Skip to main content

VIQC Virtual Skills
Lesson 5

Tips for Coding Fling

There are many other ways to code Fling using VEXcode IQ features or other elements of the robot. This is not an exhaustive list, but a great place to get started as you continue to code Fling.

Multiple {When Started} Blocks

By using multiple {When started} blocks, you can start two or more stacks of code at the same time.

When the project is started in this example, Fling will begin turning right for 30 degrees while spinning the Intake Motor at the same time.

Image of VEXcode IQ project with two when started blocks

"And don't wait" Modifier

It is possible to change some blocks from waiting to non-waiting by selecting the white arrow on the side of the block.

In this example, the Intake Motor will begin spinning and continue to spin for 720 degrees while the robot is driving forward for 150mm because the [Spin for] block used with the Intake Motor has the "and don't wait" modifier selected.

Read this Knowledge Base article for more information about the difference between waiting and non-waiting blocks in VEXcode IQ.

Image of VEXcode IQ project with mutliple blocks using the "and don't wait modifier"

Color Sensor

Fling is equipped with a Color Sensor on the bottom. The (Color brightness) block can be used to detect lines on the Field.

In this example, Fling will drive until a line on the Field is detected.

See this Knowledge Base article for more information about the VEX IQ Color Sensor.

Image of VEXcode IQ project using eye sensor

Distance Sensor

Fling is also equipped with a Distance Sensor to detect when Balls have been loaded onto the Catapult Arm.

In this example, Fling will continuously spin the Intake Motor until the Distance Sensor detects a Ball, then the Intake Motor will stop spinning. This example also uses two {When started} blocks as shown above.

See this Knowledge Base article for more information about the VEX IQ Distance Sensor.

Image of VEXcode IQ project that uses distance sensor data to stop intake when a ball is detected

Bumper Switch

Fling is also equipped with a Bumper Switch to detect when the Catapult Arm is fully lowered. This switch was also covered briefly in Lesson 4.

In this example, Fling will launch a Ball and continuously spin the Catapult Motor until the Bumper Switch is pressed, then the Catapult Motor will stop spinning. This example also uses the Distance Sensor as shown above.

See this Knowledge Base article for more information about the VEX IQ Bumper Switch.

image of VEXcode IQ project that uses the Bumper switch


Select Return to Lessons to go back to the Lesson Overview.