code/WPILib/CInterfaces/CUltrasonic.cpp
/**
 * Get the range in inches from the ultrasonic sensor.
 * @return double Range in inches of the target returned from the ultrasonic sensor. If there is
 * no valid value yet, i.e. at least one measurement hasn't completed, then return 0.
 *
 * @param pingSlot The slot for the digital module for the ping connection
 * @param pingChannel The channel on the digital module for the ping connection
 * @param echoSlot The slot for the digital module for the echo connection
 * @param echoChannel The channel on the digital module for the echo connection
 */
Get the range in inches from the ultrasonic sensor.
@return double Range in inches of the target returned from the ultrasonic sensor. If there is
no valid value yet, i.e. at least one measurement hasn't completed, then return 0.

@param pingSlot The slot for the digital module for the ping connection
@param pingChannel The channel on the digital module for the ping connection
@param echoSlot The slot for the digital module for the echo connection
@param echoChannel The channel on the digital module for the echo connection
Get the range in inches from the ultrasonic sensor . @return double Range in inches of the target returned from the ultrasonic sensor . If there is no valid value yet i . e . at least one measurement hasn ' t completed then return 0 . @param pingSlot The slot for the digital module for the ping connection @param pingChannel The channel on the digital module for the ping connection @param echoSlot The slot for the digital module for the echo connection @param echoChannel The channel on the digital module for the echo connection
double GetUltrasonicInches(UINT32 pingSlot, UINT32 pingChannel, UINT32 echoSlot, UINT32 echoChannel)
{
	Ultrasonic *us = USptr(pingSlot, pingChannel);
	if (us != NULL)
		return us->GetRangeInches();
	else
		return 0.0;
}
double GetUltrasonicInches ( UINT32 pingSlot , UINT32 pingChannel , UINT32 echoSlot , UINT32 echoChannel ) { Ultrasonic * us = USptr ( pingSlot , pingChannel ) ; if ( us != NULL ) return us -> GetRangeInches ( ) ; else return 0.0 ; }
Get the range in inches from the ultrasonic sensor.
Get the range in inches from the ultrasonic sensor .