https://os.mbed.com/users/yo2lts/code/HX711/

Dependencies:   HX711 TextLCD mbed

Fork of Nucleo_HX711_Demo by Cr300-Litho

Revision:
1:0ab2610596bf
Parent:
0:c4eaea48d411
--- a/main.cpp	Fri Jun 12 16:17:21 2015 +0000
+++ b/main.cpp	Mon Jan 29 07:31:04 2018 +0000
@@ -1,25 +1,57 @@
 #include "mbed.h"
-#include "TextLCD.h" //Librairie Ecran text
+//#include "TextLCD.h" //Librairie Ecran text
 #include "HX711.h" //Librairie HX711 en dévellopement
-
-
-TextLCD lcd(D2, D3, D4, D5, D6, D7, TextLCD::LCD20x4); // Déclaration TextLCD.
-     
-HX711 scale(A1,A0,64); //(pinData, pinSCK, gain [128|32|64])
-DigitalIn mybutton(USER_BUTTON);//Boutton
+ 
+ 
+HX711 scale(PA_1,PA_0,128); //(pinData PA_1, pinSCK PA_0, gain [128|32|64])
+//DigitalIn mybutton(USER_BUTTON);//Boutton
+Serial pc(PA_2, PA_3); // tx-feher, rx-feher
+DigitalOut myled(PC_13);
 
 int main() 
 {
-    int weight;
-
+    
+    pc.printf("+++ start +++\r\n");
+    myled = 0;
+    wait(5);
+    myled = 1;
+    
+    float weight;
+  //  float suly;
+    
+    long ADCertek;
+    long TAREertek;
+    long float merleg;
+    
+    
+    TAREertek = scale.getValue();   //leolvasom TARE
+ //   pc.printf("TARE INITIAL Erteke = \n", TAREertek);
     while(1) 
     {
-        if (!mybutton) 
-            scale.tare();
-            
-        weight = scale.getGram();
-        lcd.cls();
-        lcd.locate(0,0);
-        lcd.printf("Value = %i g", weight);
+    //if (!mybutton) 
+    //   scale.tare();
+    
+       scale.setScale(10000);
+    
+       scale.averageValue(10);
+    
+    
+       ADCertek = scale.getValue();     // Leolvasom a modult    
+       pc.printf("ADC Ertek = \r\n", ADCertek);
+       merleg = ((long float)ADCertek-(long float)TAREertek)/11100;         // ADC ertek grama alakitasa
+       pc.printf("ADCertek : %ld          Merleg : %.3lf\n",ADCertek,merleg);    // Eredmeny kiirasa
+  
+  
+       weight = scale.getGram();
+
+//        suly = weight/39.34;
+ 
+//        pc.printf("------------- new\r\n");
+       pc.printf("Weight gram= %.4lf\n", weight);
+//        pc.printf("atalakitas weight= %.2lf\n", suly);
+        wait(1);
+
+
+
     }
 }