I just started using pros this year, and I’m a little confused on how to use toggle in driver control. I know get_digital means that if you hold it, it’ll run but I don’t know how to toggle it, because there doesn’t seem to be something for that in the API. How would I do this?
1 Like
https://pros.cs.purdue.edu/v5/api/cpp/misc.html#get-digital-new-press
Read about master.get_digital_new_press
. this should be able to do what you want
if (master.get_digital_new_press(E_CONTROLLER_DIGITAL_A)) {
// Toggle
}
1 Like
This should work for motors too, not just pneumatics right?
Yes. You will need to add more code than just that, so let me know if you need more help than just this
1 Like
I do know how to get the motors running, but when we change the motor velocity to 0, is it possible to change the brake type to coast, like you would do in VEXcode?
https://pros.cs.purdue.edu/v5/api/cpp/motors.html#set-brake-mode
Try to read the docs by yourself and figure out how to do that. If you can't, then click here.
Add the line motor.set_brake_mode(pros::E_MOTOR_BRAKE_COAST)
to the start of your driver code (outside of the loop) to have the motor coast whenever it has an input of 0 rpm
1 Like