uart_load_cell

Dependencies:   mbed HX711

Files at this revision

API Documentation at this revision

Comitter:
rajas1812
Date:
Tue Mar 19 03:11:31 2019 +0000
Commit message:
tera

Changed in this revision

HX711.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	Tue Mar 19 03:11:31 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Volt72/code/HX711/#5d57c2060e7b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 19 03:11:31 2019 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include <stdio.h>
+#include <string.h>
+#include <HX711.h>
+
+Serial display(USBTX, USBRX);                    // pc = teraterm
+Serial pc1(PTC17, PTC16);                   //pc1 = uart
+HX711 weight(D9,D8);                         //setting pins D9 = data and D8 = slk
+
+int main()
+{ 
+    while(1){
+        display.printf("Hello");
+        long value;
+        value = weight.getValue();
+        long result;
+        result = value - 8349548;
+        long grams;
+        grams = result / 217.2;
+        display.printf("%ld\n",grams);
+        
+        if (grams >= 180){
+            pc1.baud(115200);
+            pc1.printf("coap CON POST fd4e:f95e:2d21:cb00:3968:8fc0:cf24:cf17 /led rgb r255 g0 b0\n");
+            display.printf("Trash Full!!! Calling the Drone...\r\n");
+            }
+            
+        else{
+            pc1.baud(115200);
+            pc1.printf("coap CON POST fd4e:f95e:2d21:cb00:3968:8fc0:cf24:cf17 /led rgb r0 g0 b0\n");
+            display.printf("No action required\r\n");
+            }
+        wait(10);
+        }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 19 03:11:31 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc
\ No newline at end of file