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.
Revision 5:cc084768bab9, committed 2019-02-16
- Comitter:
- khuifang2202
- Date:
- Sat Feb 16 18:20:09 2019 +0000
- Parent:
- 4:e0f9c9fb4cf3
- Commit message:
- huifang;
Changed in this revision
ultrasonic.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/ultrasonic.cpp Mon Nov 24 20:23:07 2014 +0000 +++ b/ultrasonic.cpp Sat Feb 16 18:20:09 2019 +0000 @@ -25,9 +25,17 @@ void ultrasonic::_updateDist() { + //int x=0; end = _t.read_us (); done = 1; - _distance = (end - start)/6; + _distance = (end - start)/305; + //_distance = (end-start); + //_distance = ((_distance)<<2+_distance)/29; // (distance*5)/29 is distance/5.8 + //x = (end-start); + //_distance = (x<<2+x)/29; //(distance*5)/29 is distance/5.8 + //x = (end - start); + //_distance = (x<<2+x)/29; + //_distance = ((_distance)<<2+_distance)/29; _tout.detach(); _tout.attach(this,&ultrasonic::_startTrig, _updateSpeed); }