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: HC_SR04_Ultrasonic_Library mbed
main.cpp
00001 #include "mbed.h" 00002 #include "ultrasonic.h" 00003 00004 00005 PinName trig = PA_10; 00006 PinName echo = PA_9; 00007 float updateSpeed = 1; // 1 Hz, 1 fois par sec 00008 float timeout = 2; 00009 00010 00011 int mesure = 0; 00012 00013 int main() 00014 { 00015 00016 ultrasonic(trig, echo, updateSpeed, timeout); 00017 00018 while(1) 00019 { 00020 mesure = getCurrentDistance(); 00021 wait(0.1); 00022 printf("%d\n",mesure); 00023 wait(0.2); 00024 } 00025 }
Generated on Fri Aug 12 2022 06:43:54 by
1.7.2