Velocity Shifts In Incroments (Programmed to Buttons)

I saw this cool function me and my team wanted to implement on our bot while browsing the forums for awesome ideas for our bot. We found this post, but it is years old, and no solution was ever found for it. I need help figuring out how to configure the code, and figuring out which response was the solution. (We are coding in Vexcode v5 Pro text.)

Any help is appreciated! <333

Topic with no solution link: How to change turn velocity by 5% with a button press

1 Like

This piece of code from that thread looks like it works. There are some things you might want to adjust though, such as the speed being capped between 50 and 100%.

Wouldn’t that just lower the velocity while you hold down the button? I want it to go down without having to hold the button down for a long time

This code lowers the velocity each time the button is pressed. If you wanted it to go down faster, you could change the increment from 5% each time to something bigger. Without the variables like buttonUpRegistered it would be able to go down continuously while holding the button, but it would force the increment to be slow to prevent the loop from changing your speed by too much, too quickly and require precise timing on the duration of pressed to get a specific speed.

Ah, that makes sense, thanks for all your help! <33

When you are implementing this code, what do you put in place of “scaledValue”? I was using this code and the “scaledValue” phrase came up as an error.