CNA ltc1655 et adg715

Dependencies:   mbed

Revision:
0:fbc63633ebee
diff -r 000000000000 -r fbc63633ebee cherche_equilibre.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cherche_equilibre.h	Wed Jun 10 07:20:17 2015 +0000
@@ -0,0 +1,45 @@
+unsigned int  cherche_equilibre (unsigned int valnum)
+{
+    int i;
+    unsigned int val;
+    float result;
+    val=0;
+    for (i=0; i<=4; i=i++) {
+        valnum =15100;
+        cna.write(valnum);
+        while (ina.read()>=0.5) {
+            valnum = valnum+1;
+             wait(0.020);
+            cs=0;
+            //  pc.printf("%U \n\r",ina.read());
+            cna.write(valnum);
+            cs=1;
+        }
+        pc.printf("Val_CAN %U \n\r",valnum);
+        val=val+valnum;
+        valnum =15500;
+        cna.write(valnum);
+        while (ina.read()<=0.5) {
+
+            valnum = valnum-1;
+            wait(0.020);
+            cs=0;
+            //  pc.printf("%U \n\r",ina.read());
+            cna.write(valnum);
+            cs=1;
+        }
+        val=val+valnum;
+        pc.printf("Val_CAN %U \n\r",valnum);
+    }
+    
+    pc.printf("Val_CAN %U \n\r",val);
+    result=val/10;
+    val=result;
+    cs=0;
+    cna.write(val);
+    cs=1;
+    pc.printf("Equilibre capteur 1= %f    \n\r",result);
+    return (val);
+
+
+}
\ No newline at end of file