fb5.c
// This Function calculates the actual distance in millimeters(mm) from the input
// analog value of Sharp Sensor. range 40 mm to 300 mm
This Function calculates the actual distance in millimeters(mm) from the input
analog value of Sharp Sensor. range 40 mm to 300 mm
This Function calculates the actual distance in millimeters ( mm ) from the input analog value of Sharp Sensor . range 40 mm to 300 mm
unsigned int Sharp_GP2D12_estimation(unsigned char adc_reading)
{
	float distance;
	unsigned int distanceInt;
	distance = (int)(10.00*(1/(0.001240875*adc_reading + 0.005)));
	distanceInt = (int)distance;
	if(distanceInt>800)
	{
		distanceInt=800;
	}
	return distanceInt;
}
unsigned int Sharp_GP2D12_estimation ( unsigned char adc_reading ) { float distance ; unsigned int distanceInt ; distance = ( int ) ( 10.00 * ( 1 / ( 0.001240875 * adc_reading + 0.005 ) ) ) ; distanceInt = ( int ) distance ; if ( distanceInt > 800 ) { distanceInt = 800 ; } return distanceInt ; }
This Function calculates the actual distance in millimeters(mm) from the input
analog value of Sharp Sensor.
This Function calculates the actual distance in millimeters ( mm ) from the input analog value of Sharp Sensor .