Rajas Chitanvis
/
GDAD_UART_Thread
uart_load_cell
main.cpp
- Committer:
- rajas1812
- Date:
- 2019-03-19
- Revision:
- 0:80fbb0a75a87
File content as of revision 0:80fbb0a75a87:
#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); } }