Frank Girald / Mbed 2 deprecated loadcell_hx711

Dependencies:   HX711 TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
franni
Date:
Fri May 05 20:16:31 2017 +0000
Commit message:
Celda de Carga HX711

Changed in this revision

HX711.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
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/HX711.lib	Fri May 05 20:16:31 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/laskowsk/code/HX711/#716e1cbdac61
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Fri May 05 20:16:31 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 05 20:16:31 2017 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include "HX711.h"
+#include "TextLCD.h" 
+
+DigitalOut led(LED_BLUE);
+HX711 scale(PTC9, PTC8);
+
+Serial rs232(USBTX, USBRX);    // USB Serial Terminal
+TextLCD lcd(PTE20,PTE21,PTE22,PTE23,PTE29,PTE30, TextLCD::LCD16x2); // Rs, E, d4, d5, d6, d7 
+
+float calibration_factor = 1000; //Ajustar este valor para calibrar el peso exacto
+int averageSamples = 100;
+
+int main(void)
+{
+     
+    scale.setScale(0);
+    scale.tare(); //Reset the scale to 0
+    
+    long zero_factor = scale.averageValue(averageSamples); // Saca promedio de varias lecturas para estabilizar la medida
+     
+    while (true) {
+        scale.setScale(calibration_factor); 
+        float weight = scale.getGram();
+        rs232.printf("Peso: %.2f\n", weight);
+        lcd.locate(0,0);
+        lcd.printf("Peso: %.2f Grms", weight);
+        led = !led; // toggle led
+        wait(0.2f);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 05 20:16:31 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/794e51388b66
\ No newline at end of file