Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SystemFunctions.cpp
- Committer:
- jordaahh
- Date:
- 2017-02-07
- Revision:
- 2:baf8a7b2b150
- Parent:
- 0:b5ce567b469c
- Child:
- 3:306d3725ed04
File content as of revision 2:baf8a7b2b150:
// Functions to control and operated the system
#include "SystemFunctions.h"
void digitalFilter(){
i=0;
j=0;
for(i=0; i<5; i++){
LDR1Array[j]=LDR1;
LDR2Array[j]=LDR2;
LDR3Array[j]=LDR3;
LDR4Array[j]=LDR4;
j++;
}
Average1 = ((LDR1Array[4]*1)+(LDR1Array[3]*0.8)+(LDR1Array[2]*0.6)+(LDR1Array[1]*0.4)+(LDR1Array[0]*0.2))/3;
Average2 = ((LDR2Array[4]*1)+(LDR2Array[3]*0.8)+(LDR2Array[2]*0.6)+(LDR2Array[1]*0.4)+(LDR2Array[0]*0.2))/3;
Average3 = ((LDR3Array[4]*1)+(LDR3Array[3]*0.8)+(LDR3Array[2]*0.6)+(LDR3Array[1]*0.4)+(LDR3Array[0]*0.2))/3;
Average4 = ((LDR4Array[4]*1)+(LDR4Array[3]*0.8)+(LDR4Array[2]*0.6)+(LDR4Array[1]*0.4)+(LDR4Array[0]*0.2))/3;
}
void servoMovement(){
OverallAverage = (Average1 + Average2 + Average3 + Average4)/4;
}