uart_load_cell

Dependencies:   mbed HX711

Revision:
0:80fbb0a75a87
--- /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