From edfda65fef5602afcba9bc2761b25695a76a34d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jasper=20G=C3=BCldenstein?= Date: Mon, 16 Nov 2020 13:02:05 +0100 Subject: [PATCH] servo range --- keil_project/Services/Servo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;