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 15:43f5bda97488, committed 2020-09-28
- Comitter:
- g0dd4
- Date:
- Mon Sep 28 19:17:00 2020 +0000
- Parent:
- 14:dd3c756c6d48
- Commit message:
- Creation de la fonctions convertToDistance;
Changed in this revision
| captUS.cpp | Show annotated file Show diff for this revision Revisions of this file |
| captUS.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/captUS.cpp Wed Sep 16 12:31:54 2020 +0000
+++ b/captUS.cpp Mon Sep 28 19:17:00 2020 +0000
@@ -7,12 +7,14 @@
Ticker ticker_US;
void captUS_init(){
- tps.start();}
+ tps.reset();
+ tps.start();
+}
void captUS_trig(){
tps.reset();
trigger=1;
- wait(0.00002);
+ wait_us(20);
trigger=0;
}
@@ -33,3 +35,26 @@
void echoRise6(){us_out[5]=tps.read_us();}
void echoFall6(){us_out[5]=(tps.read_us()-us_out[5])/2;}
+
+
+float* convertToDistance(){
+ /**************************************
+ *création d'un tableau où l'ensemble *
+ *des distance serons stockées *
+ **************************************/
+ float distance[6];
+
+ /**************************************
+ * Nous convertisons grâce au valeur *
+ * qui sont retournées par echoRiseX *
+ * et echoFallx *
+ **************************************/
+ for(char i = 0; i<6;i++)
+ distance[i] = 10*(us_out[i].read_us()-correction)/58.0 ;
+
+ /*************************************
+ * Nous retournons le tableau qui *
+ * contiens l'ensemble des distances *
+ *************************************/
+ return distance;
+}
--- a/captUS.h Wed Sep 16 12:31:54 2020 +0000 +++ b/captUS.h Mon Sep 28 19:17:00 2020 +0000 @@ -20,4 +20,10 @@ void echoRise5(); void echoFall5(); void echoRise6(); -void echoFall6(); \ No newline at end of file +void echoFall6(); + +/********************************** + * Création d'une fonction qui * + * convertis le temps en distance * + **********************************/ +float* convertToDistance(); \ No newline at end of file