jordan harper
/
ServoControl
Diff: main.cpp
- Revision:
- 3:306d3725ed04
- Parent:
- 2:baf8a7b2b150
diff -r baf8a7b2b150 -r 306d3725ed04 main.cpp --- a/main.cpp Tue Feb 07 14:21:54 2017 +0000 +++ b/main.cpp Sun May 21 12:50:37 2017 +0000 @@ -1,28 +1,20 @@ -// Hello World to sweep a servo through its full range +/** +@file main.cpp + +@brief Servo Control Algorithm implementation + */ #include "mbed.h" #include "Servo.h" #include "SystemFunctions.h" -Servo servo1(p21); // PWM out to servo in first axis (Solar Azimuth) -Servo servo2(p22); // PWM out to servo in second axis (Solar Altitude) - -AnalogIn pot(p20); // Linear pot input for manual control [initial circuit] - -AnalogIn LDR1(p15); // Top Left LDR -AnalogIn LDR2(p16); // Top Right LDR -AnalogIn LDR3(p17); // Bottom Left LDR -AnalogIn LDR4(p18); // Bottom Right LDR - -int main() { - - servo1.calibrate(range, 45.0); // *****check this fucntion****** - +int main() { + initialiseServo(); + // positionTest(); // Uncomment to test servomotor movement. while(1){ - // initial code for testing one servo with a linear potentiometer. - position = pot; - wait_ms(0.5); - servo1 = position; - } + digitalFilter(); + servoMovement(); + //serialRead(); // Uncomment to use serial communication with PC to log analog data. (CoolTerm) + } }