the title tells my problem… how do I do this?
Basically what you do is in your user control loop, set a speed variable, and write different functions for different buttons, and then at the end of the loop, assign speed to flywheel
ok I am not the most educated programmer in the world and all I got from that is create variables for different functions. can you explain in greater detail?
What programming language are you using? Do you want to do something were if you hold one button the motor moves as speed A, if you hold a different button it moves at speed B, etc or do you want to do a toggle control where if you tap the button it goes to speed A, tap it again goes to speed B, tap it again goes to speed C, etc?
im using easy c and I want it to where if I press button a it goes 100% button b 80% and so on
Sorry, but that still isn’t very informative. What you’re trying to accomplish can be done in 1 of 2 ways, either through a toggle button or a button that you hold down. What we’re trying to figure out is if you’d like to press the button once to set the speed or hold the button down to set the speed.
For example, I can either hit Button A once to set the motor speed to 100% or I can hold Button A down to set the motor to 100%.
I think you just adjust the motor power levels.
I want to hold down button a to be 100% then switch over to button b and hold it down for 75%
In that case, you just need to set up some if and else if loops.
if(Button A == pressed && Button B == not pressed)
{
motors = 100%;
}
else if(Button B == pressed && Button a == not pressed)
{
motors = 75%;
}
I believe that in EasyC, you have to use a getJoystickDigital block to output the value of your buttons to a variable in order to use your button in an if loop.