Use this repository for pilot an ultrasonic sensor
Fork of UltrasonicSensor by
Revision 1:9d56714c1119, committed 2018-01-15
- Comitter:
- danky02
- Date:
- Mon Jan 15 21:12:25 2018 +0000
- Parent:
- 0:8ca9f71b386d
- Commit message:
- Use this library for pilot an ultrasonic sensor
Changed in this revision
UltrasonicSensor.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8ca9f71b386d -r 9d56714c1119 UltrasonicSensor.h --- a/UltrasonicSensor.h Mon Jan 15 20:35:11 2018 +0000 +++ b/UltrasonicSensor.h Mon Jan 15 21:12:25 2018 +0000 @@ -25,6 +25,29 @@ #include <mbed.h> namespace mbed { +/** \addtogroup drivers */ + +/** + * @note UltrasonicSensor + * + * Example: + * @code + * #include "mbed.h" + * #include "UltrasonicSensor.h" + * + * UltrasonicSensor sensor(D9, D8); //declare echo pin and trigger pin (echo, trigger) + + * int main(){ + * sensor.begin(); //begin the ultrasonic sensor + * while(1) { + * float dist = sensor.read(); //read distance from ultrasonic sensor in cm + * printf("%f cm \n\r", dist); + * wait(0.5); + * } + * } + * @endcode + * @ingroup drivers + */ class UltrasonicSensor {