Capteur_US

Dependencies:   mbed DRV8825

Revision:
0:dc036b67c87c
Child:
1:2fe8c402ee79
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/captUS.cpp	Wed Jul 08 19:51:28 2020 +0000
@@ -0,0 +1,28 @@
+#include "pins.h"
+
+void AresUltrasonsInit(){tps.start();}
+
+void AresUltrasons(){
+    tps.reset();
+    trigger=1;
+    wait(0.00002);
+    trigger=0;
+}
+
+void echoRise1(){us_out[0]=tps.read_us();}
+void echoFall1(){us_out[0]=(tps.read_us()-us_out[0])/2;}
+
+void echoRise2(){us_out[1]=tps.read_us();}
+void echoFall2(){us_out[1]=(tps.read_us()-us_out[1])/2;}
+
+void echoRise3(){us_out[2]=tps.read_us();}
+void echoFall3(){us_out[2]=(tps.read_us()-us_out[2])/2;}
+
+void echoRise4(){us_out[3]=tps.read_us();}
+void echoFall4(){us_out[3]=(tps.read_us()-us_out[3])/2;}
+
+void echoRise5(){us_out[4]=tps.read_us();}
+void echoFall5(){us_out[4]=(tps.read_us()-us_out[4])/2;}
+
+void echoRise6(){us_out[5]=tps.read_us();}
+void echoFall6(){us_out[5]=(tps.read_us()-us_out[5])/2;}