|
Re: Create a low speed drive in programming
Or perhaps have it divide the difference from 127 in half, add/subtract them and send that to PWMs
Like if your joystick is at 250
250 - 127 = 123 / 2 = 61.5 + 127 = 188.5
Code:
int DriveLimiter(int joyvalue)
{
if(joyvalue > 127)
{
return ((joyvalue - 127) / 2) + 127;
}
if(joyvalue < 127)
{
return 127 - ((127 - joyvalue) / 2);
}
}
I just did that off top of my head, don't shoot me if it's wrong, but that's the general idea. I think. 
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!
I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
|