This library is for the HC-SR04 ultrasonic ranging module . The module is very easy use , now with the library , user just need a function then he can get the distance .
Library includes 3 functions for user :Ultrasonic(int TP, int EP)
This is a initial function for ultrasonic ranging module, choose the pins for module Trig and Echo pin. You need using this function before Setup() to define the pin map.
then you define the digital pin 13 of Arduino for the Trig pin of HC-SR04. And the pin 12 for Echo pin.long Timing()
Trigger the ultrasonic ranging module work and return the duration that Echo pin keep high level.
example: long time; Ultrasonic hcsr; time = hcsr.Timing();
Then you start the HC-SR04 for ranging and you get the time the Echo pin keep high, you can change the time corresponds to the distance : Distance = ((Duration of high level)*(Sonic :340m/s))/2long Ranging(int sys)
If you don't want to change the time into distance yourself , this function will help you get the distance immediate. And the function has a parameter sys, you can use CM or ICN , than you get the distance show as centimeter or inch. This function will call the Timing() and you don't need to use the Timing() before it.
example: long distance; Ultrasonic hcsr; distance = hcsr.Ranging(CM);
Hope it help.