Works with interrupts
Fork of HC_SR04_Ultrasonic_Library by
Revision 5:36fcbbb149d8, committed 2017-12-26
- Comitter:
- maskas
- Date:
- Tue Dec 26 09:28:16 2017 +0000
- Parent:
- 4:e0f9c9fb4cf3
- Commit message:
- add missing "start" method to the first constructor.
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 Tue Dec 26 09:28:16 2017 +0000
@@ -4,6 +4,7 @@
{
_updateSpeed = updateSpeed;
_timeout = timeout;
+ _t.start ();
}
ultrasonic::ultrasonic(PinName trigPin, PinName echoPin, float updateSpeed, float timeout, void onUpdate(int))
@@ -16,11 +17,13 @@
}
void ultrasonic::_startT()
{
+ //printf("Start2: %d\n", _t.read());
if(_t.read()>600)
{
_t.reset ();
}
start = _t.read_us ();
+ //printf("Start: %d\n", start);
}
void ultrasonic::_updateDist()
