/**
* This command calculates the average of a set of rpm from the HallEffectSensor
* class
- *
+ *
* @author shaina
*
*/
*/
public double getAverage() {
double total = 0;
+ int zeros = 0;
for (int i = 0; i < index; i++) {
+ if (bufferVals[i] == 0)
+ zeros++;
total += bufferVals[i];
}
+ if (zeros != bufferVals.length)
+ return total / (bufferVals.length - zeros);
return total / bufferVals.length;
}
}