test
Fork of HCSR04 by
Diff: HCSR04.h
- Revision:
- 5:a667b621f625
- Parent:
- 4:aae70f15357f
- Child:
- 6:cf3e4e307d15
--- a/HCSR04.h Mon Dec 07 09:37:21 2015 +0000 +++ b/HCSR04.h Mon Dec 07 09:57:48 2015 +0000 @@ -8,13 +8,16 @@ * #include "mbed.h" * #include "HCSR04.h" * - * Serial pc(USBTX, USBRX); // communication with terminal - * + * Serial pc(USBTX, USBRX); + * * int main() { - * HCSR04 sensor(p5, p7); // instantiate the sensor object + * HCSR04 sensor(p5, p7); + * sensor.setRanges(10, 110); + * pc.printf("Min. range = %g cm\n\rMax. range = %g cm\n\r", + * sensor.getMinRange(), sensor.getMaxRange()); * while(1) { - * pc.printf("Distance: %5.1f cm\r", sensor.getDistance_cm()); - * wait_ms(975); // print the result every 1 second + * pc.printf("Distance: %5.1f mm\r", sensor.getDistance_mm()); + * wait_ms(500); * } * } * @endcode