Does anyone know how to make a thread in Vex Code V5 blocks?
Each time you add a header block it becomes a different task.
Generated Code
def ondriver_drivercontrol_0():
global myVariable
# Do a task
def ondriver_drivercontrol_1():
global myVariable
# Do another task at the same time
# create a function for handling the starting and stopping of all autonomous tasks
def vexcode_auton_function():
# Start the autonomous control tasks
# wait for the driver control period to end
while( competition.is_autonomous() and competition.is_enabled() ):
# wait 10 milliseconds before checking again
wait( 10, MSEC )
# Stop the autonomous control tasks
def vexcode_driver_function():
# Start the driver control tasks
driver_control_task_0 = Thread( ondriver_drivercontrol_0 )
driver_control_task_1 = Thread( ondriver_drivercontrol_1 )
# wait for the driver control period to end
while( competition.is_driver_control() and competition.is_enabled() ):
# wait 10 milliseconds before checking again
wait( 10, MSEC )
# Stop the driver control tasks
driver_control_task_0.stop()
driver_control_task_1.stop()
3 Likes