Tony Kennedy
/
project_july_2020
rev1
Diff: main.cpp
- Revision:
- 0:f6dbd5e25623
- Child:
- 1:459034942ff5
diff -r 000000000000 -r f6dbd5e25623 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jun 25 15:29:26 2020 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" +#include "C12832.h" + + +C12832 lcd(p5, p7, p6, p8, p11); +Serial pc(USBTX, USBRX); // tx, rx +float value; +float weight; +AnalogIn pot1(p19); +DigitalOut led1(LED1); +DigitalOut led3(LED3); +DigitalOut led4(LED4); +int i; + +int main() { + while(1) { + value = pot1.read(); + weight = value*1500 ; + lcd.locate(0,0); + lcd.printf("weight %.2f", weight); + if (weight > 1230 && weight < 1360) + //pc.printf("TRUE"); + {led1 = 1; + led3 = 0; + led4 = 0; + + + } + if ( weight < 1229) + { + led1 = 0; + led4 = 0; + led3 = 1; + + } + if ( weight > 1361) + { + led1 = 0; + led3 = 0; + led4 = 1; + } + + + + + + + } +}