Stop a controller from working until

Using VEX Code Block how would we stop a handheld controller from working until some other action happens for example controller wont work until touchLED is pressed.

There are several ways to do this, here’s some example code that does what you describe:

45%20AM

1 Like

how would this work if we set the controller options in motor and sensor setup. we do not even have to write any code if we do that. I will try this but I am not sure this will stop the controller from working as a drivetrain.

If you want to do something like this, your best bet is probably to not use the automatic controller setup, and instead write all your controller code manually as above.

Edit: Although, if you only want to have some of the controls affected by the status of the sensor, then you may be able to set up the other ones automatically; the automatic and manual controller code might play nicely with each other in that situation.

1 Like

to not use the automatic controller setup would we just not add the controller to the motor and sensor setup. Not sure how to not automatically set it up. Thanks for the help

You still have to add the controller in the ‘motor and sensor setup’ area - otherwise the blocks to get its status won’t appear. If you don’t want to use the automatic controller configuration you can just leave all the buttons blank, and click “Done” without configuring anything when adding the controller.

2 Likes

great, thanks for the help.

1 Like

Update - @rhowbot pointed out via PM that OP’s intent may have been to toggle control of a motor when a touch LED is pressed, while my code above required the LED to be pressed the whole time for the motors to be controlled. Here’s some code that toggles control when a touch LED is pressed:

35%20PM

1 Like