jordan harper
/
ServoControl
Control servo motors
Diff: SystemFunctions.h
- Revision:
- 3:306d3725ed04
- Parent:
- 2:baf8a7b2b150
--- a/SystemFunctions.h Tue Feb 07 14:21:54 2017 +0000 +++ b/SystemFunctions.h Sun May 21 12:50:37 2017 +0000 @@ -1,21 +1,42 @@ - - -float range = 0.00095; // maximum on period set to 0.95ms -float position; //= 0.5; // set initial position to middle // can probably take this out?? +/** +@file SystemFunctions.h +@brief Header file containing functions prototypes. +@author Jordan Harper +@date March 2017 +*/ -float LDR1Array[5]; -float LDR2Array[5]; -float LDR3Array[5]; -float LDR4Array[5]; +/* functions */ + +/** Sets signal rate for serial connection to PC and displays string of measured analog signals. +@param pc.baud() - sets signal freq. +@param pc.printf() - prints string to PC (CoolTerm). +@returns Float values measured from each LDR. +*/ +void serialRead(); -float Average1; -float Average2; -float Average3; -float Average4; +/** Records analog data from each LDR, places it in an array and gives array values weights based on how new the measurement is (organises them by significance to get accurate average signal). +@param i - counter variable. +@param j - counter variable. +@param Average1 - Average value for LDR1. +@param Average2 - Average value for LDR2. +@param Average3 - Average value for LDR3. +@param Average4 - Average value for LDR4. +@returns Average value for each LDR. +*/ +void digitalFilter(); -float OverallAverage; +/** Moves the servo based on the signals measured from LDR's. +@param OverallAverage - Base value of LDR signals. +@param Servo1 - signal sent to Servo 1 in analog form. +@param Servo2 - signal sent to Servo 2 in analog form. +*/ +void servoMovement(); -int i; -int j; +/** Calibrates PWM signal. +@param servo.calibrate() - sets range of movement in degrees for Pulse Width value. +*/ +void initialiseServo(); -void digitalFilter(); +/** Automatically moves servos to test the analog signal conversion to PWM. +*/ +void positionTest(); \ No newline at end of file