rev1

Dependencies:   mbed C12832

main.cpp

Committer:
tonyk37
Date:
2020-07-13
Revision:
2:a17516deccae
Parent:
1:459034942ff5
Child:
3:0c35cd39b8b1

File content as of revision 2:a17516deccae:

#include "mbed.h"
#include "C12832.h"


C12832 lcd(p5, p7, p6, p8, p11);
Serial pc(USBTX, USBRX); // tx, rx
float value;  //measured value
float weight; //process variable
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) //process target set point
        {
        led1 = 1; //output signal for process beacon and cylinder
        led3 = 0;
        led4 = 0; 
        
            lcd.locate(0,20);
            lcd.printf("TRUE");
            wait(0.20);
            lcd.cls();
            }
            
    
            if ( weight < 1229)
            {
                led1 = 0;
                led4 = 0;
                led3 = 1; // output signal for Red light on process beacon
            
                lcd.locate(0,20);
                lcd.printf("Missing QTY");
                wait(0.20);
                lcd.cls();
                           
                }
             if ( weight > 1361)
             {
                 led1 = 0;
                 led3 = 0;
                 led4 = 1; // output signal for Blue light on process beacon
                 
                 lcd.locate(0,20);
                 lcd.printf("EXCESS QTY");
                 wait(0.20);
                 lcd.cls();
                 
                 }        
                
    }
}