coucou
Dependencies: HC_SR04_Ultrasonic_Library mbed
Diff: main.cpp
- Revision:
- 0:5fba740a37eb
- Child:
- 1:3bad1115bf14
diff -r 000000000000 -r 5fba740a37eb main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Sep 28 14:16:26 2016 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "ultrasonic.h" + + +PinName trig = PA_10; +PinName echo = PA_9; +float updateSpeed = 1; // 1 Hz, 1 fois par sec +float timeout = 2; + + +int mesure = 0; + +int main() +{ + +ultrasonic(trig, echo, updateSpeed, timeout); + + while(1) + { + mesure = getCurrentDistance(); + wait(0.1); + printf("%d\n",mesure); + wait(0.1); + } +}