예제 #1
0
/*
 -Pre-Reqs: SetupADC(), adcInput(), irDistance(),
 -Desc: Calls irDistance until a valid value is found, returns
        this value.
 -Input: None
 -Output: double
-*/
double irDistanceValid(){
    double distance;
    while(1){
        distance = irDistance();
        if (distance != -1){
            return distance;
        }
    }
}
예제 #2
0
/*
	-Input:	uint32_t cap - max iterations allowd
	-Desc:	Same as irDistanceValid(), but with iteration cap.
			If valid value not found , returns -1
*/
double irTryDistanceValid(uint32_t cap, int delay){
    double distance;
    uint32_t x = 1;
    while(1){
        distance = irDistance();
        if (delay > 0) {
        	SystickTimer(delay);
        }
        x++;
        if (x>cap) {
		    return distance;
		}
        if (distance != -1)	{
            return distance;
        }
    }
}
예제 #3
0
float IR_rangeZone_detection::getRightDistance()
{
  return irDistance(irLEDPinRight, irRecPinRight);
}
예제 #4
0
float IR_rangeZone_detection::getLeftDistance()
{
  return irDistance(irLEDPinLeft, irRecPinLeft);
}