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.
Fork of SRF02 by
Revision 2:548b60c4cc15, committed 2016-05-04
- Comitter:
- el14tt
- Date:
- Wed May 04 10:39:39 2016 +0000
- Parent:
- 1:8e6587d88773
- Commit message:
- SRF02 library for ELEC2645 project
Changed in this revision
SRF02.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8e6587d88773 -r 548b60c4cc15 SRF02.cpp --- a/SRF02.cpp Sun Mar 08 14:21:40 2015 +0000 +++ b/SRF02.cpp Wed May 04 10:39:39 2016 +0000 @@ -1,3 +1,5 @@ + + /** @file SRF02.cpp @@ -7,6 +9,9 @@ #include "mbed.h" #include "SRF02.h" +#define SOUND_S (float)340.29 +#define SOUND_US (double)340.29/1000000 + SRF02::SRF02(PinName sdaPin, PinName sclPin) { i2c = new I2C(sdaPin,sclPin); // create new I2C instance and initialise @@ -44,6 +49,9 @@ return (data[0] << 8) | data[1]; } + + + void SRF02::error() { while(1) {