rev1

Dependencies:   mbed C12832

main.cpp

Committer:
tonyk37
Date:
2020-06-25
Revision:
0:f6dbd5e25623
Child:
1:459034942ff5

File content as of revision 0:f6dbd5e25623:

#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;
                 }   
            
            
            
                
                
                
    }
}