diff --git a/README.md b/README.md index 6400c5e..b56b506 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# Aeleron -Arduino based control for my aircraft wing project \ No newline at end of file +# Rack and Pinion +Arduino based control for my rack and pinion project, branched from general servo control \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 26f40a7..7bed0df 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,8 +6,8 @@ #define ZERO_OFFSET 90 #define BUTTON_PIN 9 //Servo travel from onshape assembly (https://cad.onshape.com/documents/d18afc04477c0a37ba3a6c4c/w/296bb2347621a61e29efeed9/e/c0daab103472e3648c63e07d?renderMode=0&uiState=67d52d3223160a63ec30cd7a) -#define MAXIMUM_ELEVATION 30 -#define MAXIMUM_DEPRESSION -55 +#define MAXIMUM_TRAVEL 90 +#define MINIMUM_TRAVEL -90 #define POT1_PIN A0 Servo servo1; @@ -25,6 +25,7 @@ void setup() { void loop() { bool button = digitalRead(BUTTON_PIN); servo1.write(servo_angle + ZERO_OFFSET); + Serial.println(servo_angle + ZERO_OFFSET); if (neutral_mode){ servo_angle = 0; if (!button){ @@ -32,8 +33,7 @@ void loop() { } } if (!neutral_mode){ - int desired_angle = map(analogRead(POT1_PIN), 0, 1023, MAXIMUM_DEPRESSION, MAXIMUM_ELEVATION); - Serial.println(desired_angle); + int desired_angle = map(analogRead(POT1_PIN), 0, 1023, MINIMUM_TRAVEL, MAXIMUM_TRAVEL); if (abs(servo_angle - desired_angle) > ANGLE_TOLERANCE){ servo_angle = desired_angle; }