FIRST Robotics Competition Discussions

Showing results for 
Search instead for 
Did you mean: 

tener dos botones de distintas velocidades del chasis

por ejemplo tener un boton que haga que trabaje el chasis a 50% de velocidad y otro turbo que trabaje el chasis al 100% como la esta trabajando hor



0 Kudos
Message 1 of 2

It looks like you're trying to figure something out and what you have isn't working.  If that's a mistake, please help me understand what you're asking.


For what you're trying to do, you can add a single button.  Read it and if it's pressed (true), wire out a constant of 0.5.  If it's false, wire out a 1.  Multiply the normal value by this and you'll get 50% when the button is pressed and 100% otherwise.


If you want either button press to control that speed outright, you'll need to use some logic to combine them together.  This works best with two selects.  The first reads the value of the first button and outputs 1 if true and 0 if false.  The second outputs 0.5 if true and the output of the first select if false.  The output of the second feeds into the motor.


That logic means if both buttons are pressed, it'll operate at 0.5  If neither are pressed, it'll operate at 0.  If either are pressed, it'll operate at the button's value.  You don't want to have multiple writes in parallel because they'll all be fighting to set the value (and you'll set each value in every single iteration of the code).

0 Kudos
Message 2 of 2