|
Re: Code to have speed of motors dependent on how hard you push the joystick
The joysticks output a value between 0 and 255 based on how far the joystick is pulled back. 0 is full back, 255 is full forward, 127 is neutral.
The speed of the motor is controlled using PWM, all you really need to know is that 0 is full back, 255 full forward, and 127 neutral.
Assuming your motor has fairly linear Power vs. RPM curve you should see a fairly linear response if you just do something like this:
PWM = joystick.
__________________
Team 701
|