|
Re: limiting voltage to the speed controller
If it was me, I don't think I'd use a lookup table. I have no idea how to set that up in easyC (which is part of why I don't use it all the time). In any case, here's my solution.
If you take the joystick input and subtract 127, you get a -127 to 127 value. Divide that by 127 to get a -1 to 1 value. Then, you multiply that by the range you want the output to be--if you want it to be half what it is, the range would be 127 / 2 = 64ish. So you'd multiply by 64. That will give you a -64 to 64 value. Then, add 127 to center it around 127 again, for the PWM output, and output it.
I've attached a screen shot of the code I use. I multiplied the value first, then divided, but that shouldn't change the answer.
JBot
__________________
Aren't signatures a bit outdated?
|