unsigned int NewPing::convert_cm(unsigned int echoTime) { #if ROUNDING_ENABLED == false return (echoTime / US_ROUNDTRIP_CM); // Convert uS to centimeters (no rounding). #else return NewPingConvert(echoTime, US_ROUNDTRIP_CM); // Convert uS to centimeters. #endif }
unsigned int NewPing::convert_in(unsigned int echoTime) { #if ROUNDING_ENABLED == false return (echoTime / US_ROUNDTRIP_IN); // Convert uS to inches (no rounding). #else return NewPingConvert(echoTime, US_ROUNDTRIP_IN); // Convert uS to inches. #endif }
unsigned long NewPing::ping_in(unsigned int max_cm_distance) { unsigned long echoTime = NewPing::ping(max_cm_distance); // Calls the ping method and returns with the ping echo distance in uS. #if ROUNDING_ENABLED == false return (echoTime / US_ROUNDTRIP_IN); // Call the ping method and returns the distance in inches (no rounding). #else return NewPingConvert(echoTime, US_ROUNDTRIP_IN); // Convert uS to inches. #endif }
unsigned long NewPing::ping_cm() { unsigned long echoTime = NewPing::ping(); // Calls the ping method and returns with the ping echo distance in uS. #if ROUNDING_ENABLED == false return (echoTime / US_ROUNDTRIP_CM); // Call the ping method and returns the distance in centimeters (no rounding). #else return NewPingConvert(echoTime, US_ROUNDTRIP_CM); // Convert uS to centimeters. #endif }
unsigned int NewPing::convert_cm(unsigned int echoTime) { return NewPingConvert(echoTime, US_ROUNDTRIP_CM); // Convert uS to centimeters. }
unsigned int NewPing::convert_in(unsigned int echoTime) { return NewPingConvert(echoTime, US_ROUNDTRIP_IN); // Convert uS to inches. }
unsigned int NewPing::ping_cm() { unsigned int echoTime = NewPing::ping(); // Calls the ping method and returns with the ping echo distance in uS. return NewPingConvert(echoTime, US_ROUNDTRIP_CM); // Convert uS to centimeters. }
unsigned int NewPing::ping_in() { unsigned int echoTime = NewPing::ping(); // Calls the ping method and returns with the ping echo distance in uS. return NewPingConvert(echoTime, US_ROUNDTRIP_IN); // Convert uS to inches. }