diff --git a/keil_project/Services/Servo.c b/keil_project/Services/Servo.c index 7796229..83984a8 100644 --- a/keil_project/Services/Servo.c +++ b/keil_project/Services/Servo.c @@ -50,7 +50,8 @@ void SERVO_Init(void){ void SERVO_SetAngle(int angle){ // set ccr3 register to alter pwm output between 1 and 2 ms - float vminCOR = 999, vmaxCOR = 1999; + angle = 90 - angle; + float vminCOR = 1250, vmaxCOR = 1950; float diffCOR = vmaxCOR - vminCOR; int ccr3Value = round(angle*diffCOR/90)+vminCOR;