I'm using a ANALOG joystick and Arduino to control X,Y motors using two PWM.
Each PWM controls the speed of the corresponding motor.
Right now it works but its not smooth, I need a exponential function to make it smooth.
Need an exponential function that changes the PWM a little bit exponentially toward the new values like this.
void loop()
{
currentX=read joystick X
currentY=read joystick Y
dx=expFunction(previousX - currentX);
dy=expFunction(previousY - currentY);
set X PWM for motor to DX;
set Y PWM for motor to DY;
previousX=currentX;
previousY=currentY;
}
the expFunction should be replaced with a real function, this I dont know.
anybody has idea, or can point me in the right direction?
thanks rough