paul legrand / Mbed 2 deprecated test_capteur_son_F303K8

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
legrandpaul
Date:
Fri Jun 18 15:26:46 2021 +0000
Commit message:
programme capteur de son

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jun 18 15:26:46 2021 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#define N 100 
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+//const int pin_SS=A0;
+AnalogIn pin_SS(A1);
+float valeur,v_son;
+
+
+int main(){
+    double tab[N];
+    double max = 0;
+
+    while(1){
+       
+        for (int i=0;i<N;i++){
+            tab[i]=  pin_SS.read();;
+        }
+
+        max = tab[0];
+        for (int j=1;j<N;j++)
+        {
+            if(tab[j]>=max) max = tab[j];    
+        }
+   
+        pc.printf("max : %f\n\n \r",max*1000);   
+        wait(0.1);    
+
+    }  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jun 18 15:26:46 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file