ErickSimoes / Ultrasonic

Minimalist library for Ultrasonic Module HC-SR04, PING))) and Seeed SEN136B5B to Arduino
MIT License
136 stars 65 forks source link

Change the distanceRead() method to receive the divisor #39

Closed ErickSimoes closed 7 years ago

ErickSimoes commented 7 years ago

The method can be simplified if the constants CM and INC represent the divisors, like this:

unsigned int Ultrasonic::distanceRead(uint8_t divisor) {
    return timing() / divisor / 2;
}