Mathis Vernay / Mbed 2 deprecated calibratio_jauge

Dependencies:   mbed HX711 BME280

Files at this revision

API Documentation at this revision

Comitter:
mathis_v
Date:
Wed Apr 15 08:05:40 2020 +0000
Parent:
0:b513811affc9
Commit message:
a

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Mar 05 09:59:18 2020 +0000
+++ b/main.cpp	Wed Apr 15 08:05:40 2020 +0000
@@ -1,66 +1,47 @@
+/*programme permettant de transmetre les valeur des jauges a un terminal par conection usb*/
+/*Recupération : putty -> Serial -> COM"X" -> Speed = 115200*/
+
 #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
+#define PINSCK A5 /*Le pin A5 est l'horologe pour la transmision de données*/
+#define CAL_FACT -125.794139 /*valeur permettant de convertir la valeur des jauges en gramme*/
 
 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*/
+HX711 s1(A1,PINSCK),s2(A2,PINSCK),s3(A3,PINSCK),s4(A4,PINSCK); /*déclaration des 4 jauges, 1er argument l'emplacement de la jauge, 2ème signale d'horloge*/
 
 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.setScale(CAL_FACT);
+    s2.setScale(CAL_FACT); 
+    s3.setScale(CAL_FACT); 
+    s4.setScale(CAL_FACT); 
+
+    /*
     s1.tare();
     s2.tare();
     s3.tare();
     s4.tare();
+    *//*Fonction à déclancher via une interation extérieur  */
     while(1) {
         print_4jauges();
     }
 }
 
-
 void print_4jauges(){
         
-        double weight1=0;
-        double weight2=0;
-        double weight3=0;
-        double weight4=0;
-        
-        double total;
+        double weight1, weight2, weight3, weight4, 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);
-        
-        
+        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