nm

Dependencies:   mbed TextLCD

main.cpp

Committer:
aldomarez
Date:
2018-10-17
Revision:
1:dec5ec0fa2dc
Parent:
41prueba.cpp@ 0:df5d1a705b6d

File content as of revision 1:dec5ec0fa2dc:

#include "mbed.h"
#include "TextLCD.h"

TextLCD lcd(D4,D5,A2,A3,A4,A5); // rs, e, d4-d7
AnalogIn val1(A0);
AnalogIn val2(A1);
DigitalOut motor(D6);
Ticker  flipper;
float v1;
float v2;
float lima = 25.0f;
float limb = 18.0f;

void  flip()  {  
    v1 = val1;
    v2 = val2;
    v1 = v1 * 33.3f;
    v2 = v2 * 33.3f;
} 
int main() {
    flipper.attach(&flip, 0.4);  
    while(1) {
        lcd.printf("V1= %f C\nV2= %f C", v1,v2);
        wait(0.2);
        lcd.cls();
        if(v1>=lima && v2<=limb) {
            motor = 1;
            }
        else motor = 0;
    }
}