Rajas Chitanvis
/
GDAD_UART_Thread
uart_load_cell
Revision 0:80fbb0a75a87, committed 2019-03-19
- Comitter:
- rajas1812
- Date:
- Tue Mar 19 03:11:31 2019 +0000
- Commit message:
- tera
Changed in this revision
diff -r 000000000000 -r 80fbb0a75a87 HX711.lib --- /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
diff -r 000000000000 -r 80fbb0a75a87 main.cpp --- /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
diff -r 000000000000 -r 80fbb0a75a87 mbed.bld --- /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