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.)
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%.
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.
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.