Hello, I've been working on making my rc plane self-stabilize in mid air using its ailerons. I have a gyro and accelerometer taking readings and outputting a kalman filtered reading from 0 to 359 degrees. What i have done is set my Output limits(Servo limits) to (1000, 2000). In the PID library example it looks like the Input value is an analog vaule from 0, 1023. So, I mapped my filtered angle from (0, 359) to (0, 1023) and made it equal the Input. I made the Setpoint variable equal to 762(~270 degrees) and mapped it as so:
AileServo = map(Output, 0, 1024, 1100, 1900);
When I upload the code, the aileron goes in the up position and wont budge, even when I move the plane from side to side. I know im doing something very wrong here. Any help is appreciated.