Mathis Vernay / Mbed 2 deprecated calibratio_jauge

Dependencies:   mbed HX711 BME280

Revision:
0:b513811affc9
Child:
1:dc5547452d12
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 05 09:59:18 2020 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#include "HX711.h"
+
+/* définition des constantes pour les jauges*/
+#define PINSCK A5
+#define CAL_FACT1 -57.8
+#define CAL_FACT2 -57.8
+#define CAL_FACT3 -57.8
+#define CAL_FACT4 -57.8
+#define AVG_SAMPLE 100
+
+Serial pc(USBTX, USBRX); /*Liaison série avec le pc*/
+
+HX711 s1(A1,PINSCK),s2(A2,PINSCK),s3(A3,PINSCK),s4(A4,PINSCK); /*déclaration des 4 jauges*/
+
+void print_4jauges();
+
+//------------------------------------------------
+ DigitalOut myled(LED1);
+ //------------------------------------------------
+ 
+ 
+int main() {
+        /*ajustement des facteur de calibrations*/
+    s1.setScale(CAL_FACT1); //Adjust to this calibration factor
+    s2.setScale(CAL_FACT2); //Adjust to this calibration factor
+    s3.setScale(CAL_FACT3); //Adjust to this calibration factor
+    s4.setScale(CAL_FACT4); //Adjust to this calibration factor
+    s1.tare();
+    s2.tare();
+    s3.tare();
+    s4.tare();
+    while(1) {
+        print_4jauges();
+    }
+}
+
+
+void print_4jauges(){
+        
+        double weight1=0;
+        double weight2=0;
+        double weight3=0;
+        double weight4=0;
+        
+        double total;
+        
+        weight1 = s1.getGram();
+        //pc.printf("j1= %.0f       ",weight1);
+        
+        weight2 = s2.getGram();
+        //pc.printf("j2= %.0f\r\n       ",weight2);
+        
+        weight3 = s3.getGram();
+        //pc.printf("j3= %.0f       ",weight3);
+        
+        weight4 = s4.getGram();
+        //pc.printf("j4= %.0f       ",weight4);
+        
+        total=weight1+weight2+weight3+weight4;
+        //pc.printf("tt= %.0f       \r\n",total);
+        
+        pc.printf("j1= %.0f j2= %.0f j3= %.0f j4= %.0f tt= %.0f                \n \r", weight1,weight2,weight3,weight4,total);
+        
+        
+} 
\ No newline at end of file