Is it possible to have driver control while a program is running? I am trying to do the freeze tag activity with the bumper switches, but no matter what code I try, it seems that driver control cannot be used while a program is running. Am I missing something simple?
I think it may simply be that you are trying to run the entire thing in an autonomous âmode.â Have you tried making the freeze-tag code run in a drive script in parallel to driver control code?
Here is one method. Note that the âYellow Hatsâ at the top of each list of instructions are âEventsâ which run independent of each other.
- The left set of code operates the robot (note that you should not use the built-in drivetrain controls configured in the devices tab)
- The right set of code tells the left code to pause for 5 seconds and then resume when the bumper is pressed.
Open up the website https://codeiq.vex.com
- Open the examples. I picked the Right Arcade example.
- Here is what the example looks like.
- Scroll down on the left and click the âMake a Booleanâ option. Name it StopDriving.
- Add a Not, And, and the StopDriving variable to the page.
- Place StopDriving into the NOT, and then move it to the left side of the AND. Next, move the IF code and place it on the right side of the AND. Finally move the AND block into the IF statement.
- Add a Set StopDriving block to the top. Your code should look like this.
- In the Devices screen, add a bumper switch
- Add a Bumper Pressed event to the block code.
- When the bumper is pressed, we want the code to enable StopDriving for five seconds. After 5 seconds the robot can resume driving.
Final code
V5 and IQ will work pretty much the same wrt the drivetrain.
The same internal drivetrain classes are used for V5, IQ and EXP.
Youâre absolutely correct that IQ and V5 projects are not directly compatible, and that device names and ports differ.
Below is the same concept implemented in V5 Blocks using the Right-Arcade example.
- A Boolean variable (
StopDriving) controls whether the drivetrain responds to the controller. - The
foreverloop continuously reads the controller and drives the motors. - The bumper event temporarily sets
StopDrivingto true, pauses driving for 5 seconds, then restores control.
So while some of the blocks look different between IQ and V5, the underlying code structure is the same: continuous driver control + an event that modifies behavior.












