Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbedConnectorInterface mbedEndpointNetwork TrashSensors
Fork of TempAndDistTest by
resource/DistanceResource.cpp@11:ac0ff76a6deb, 2015-05-25 (annotated)
- Committer:
- coyotebush
- Date:
- Mon May 25 03:21:11 2015 +0000
- Revision:
- 11:ac0ff76a6deb
- Parent:
- 8:c69fe28366d8
Move sensor code into library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| coyotebush | 7:939fdc8df95b | 1 | #include "DistanceResource.h" |
| coyotebush | 7:939fdc8df95b | 2 | |
| coyotebush | 7:939fdc8df95b | 3 | string DistanceResource::get() { |
| coyotebush | 7:939fdc8df95b | 4 | char buf[10]; |
| coyotebush | 8:c69fe28366d8 | 5 | double dist; |
| coyotebush | 7:939fdc8df95b | 6 | sensor->start(); |
| coyotebush | 8:c69fe28366d8 | 7 | while ((dist = sensor->get_dist_cm()) < 0) |
| coyotebush | 8:c69fe28366d8 | 8 | ; |
| coyotebush | 8:c69fe28366d8 | 9 | //wait_ms(500); |
| coyotebush | 8:c69fe28366d8 | 10 | snprintf(buf, 10, "%0.2f", dist); |
| coyotebush | 7:939fdc8df95b | 11 | return string(buf); |
| coyotebush | 7:939fdc8df95b | 12 | } |
