ldc+pulsador

Dependencies:   mbed TextLCD

Committer:
pablolopez89
Date:
Thu May 16 14:22:30 2019 +0000
Revision:
3:3e6485b2c9bb
Parent:
2:ad0b044d0a10
LDC + Pulsadores

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 1:7418a52375a0 1
simon 0:334327d1a416 2 #include "mbed.h"
simon 0:334327d1a416 3 #include "TextLCD.h"
simon 0:334327d1a416 4
pablolopez89 3:3e6485b2c9bb 5 TextLCD lcd(D12, D11, D5, D4, D3, D2, TextLCD::LCD16x2); // rs, e, d4, d5, d6, d7 // LCD
pablolopez89 3:3e6485b2c9bb 6
pablolopez89 3:3e6485b2c9bb 7 DigitalIn pin1(D6); // opcion 1
pablolopez89 3:3e6485b2c9bb 8 DigitalIn pin2(D7); // opcion 2
pablolopez89 3:3e6485b2c9bb 9 DigitalIn pin3(D8); // opcion 3
pablolopez89 3:3e6485b2c9bb 10 DigitalIn pin4(D9); // opcion 4
pablolopez89 3:3e6485b2c9bb 11
pablolopez89 3:3e6485b2c9bb 12 DigitalOut myled(LED1);
simon 0:334327d1a416 13
pablolopez89 3:3e6485b2c9bb 14 //int main()
pablolopez89 3:3e6485b2c9bb 15 //{
pablolopez89 3:3e6485b2c9bb 16 // lcd.printf(" INICIALIZANDO \n");
pablolopez89 3:3e6485b2c9bb 17 // lcd.printf(" BIENVENIDO \n");
pablolopez89 3:3e6485b2c9bb 18 //
pablolopez89 3:3e6485b2c9bb 19 // lcd.cls();
pablolopez89 3:3e6485b2c9bb 20 //
pablolopez89 3:3e6485b2c9bb 21 //}
pablolopez89 3:3e6485b2c9bb 22 int main()
pablolopez89 3:3e6485b2c9bb 23 {
pablolopez89 3:3e6485b2c9bb 24
pablolopez89 3:3e6485b2c9bb 25 //pin1.mode(PullUp);
pablolopez89 3:3e6485b2c9bb 26 //pin2.mode(PullUp);
pablolopez89 3:3e6485b2c9bb 27 //pin3.mode(PullUp);
pablolopez89 3:3e6485b2c9bb 28 //pin4.mode(PullUp);
pablolopez89 3:3e6485b2c9bb 29
pablolopez89 3:3e6485b2c9bb 30 lcd.cls();
pablolopez89 3:3e6485b2c9bb 31 lcd.printf(" INICIALIZANDO \n");
pablolopez89 3:3e6485b2c9bb 32 lcd.printf(" BIENVENIDO \n");
pablolopez89 3:3e6485b2c9bb 33 wait(2);
pablolopez89 3:3e6485b2c9bb 34
pablolopez89 3:3e6485b2c9bb 35 while (1)
pablolopez89 3:3e6485b2c9bb 36 {
pablolopez89 3:3e6485b2c9bb 37 lcd.cls();
pablolopez89 3:3e6485b2c9bb 38 lcd.printf(" SELECCIONE \n");
pablolopez89 3:3e6485b2c9bb 39 lcd.printf(" UNA OPCION \n");
pablolopez89 3:3e6485b2c9bb 40 wait(2);
pablolopez89 3:3e6485b2c9bb 41
pablolopez89 3:3e6485b2c9bb 42 lcd.cls();
pablolopez89 3:3e6485b2c9bb 43 lcd.printf("1. Test Aire ");
pablolopez89 3:3e6485b2c9bb 44 wait(1);
pablolopez89 3:3e6485b2c9bb 45
pablolopez89 3:3e6485b2c9bb 46 lcd.cls();
pablolopez89 3:3e6485b2c9bb 47 lcd.printf("2. Test Humedad ");
pablolopez89 3:3e6485b2c9bb 48 wait(1);
pablolopez89 3:3e6485b2c9bb 49
pablolopez89 3:3e6485b2c9bb 50 lcd.cls();
pablolopez89 3:3e6485b2c9bb 51 lcd.printf("3. Test Tierra ");
pablolopez89 3:3e6485b2c9bb 52 wait(1);
pablolopez89 3:3e6485b2c9bb 53
pablolopez89 3:3e6485b2c9bb 54 lcd.cls();
pablolopez89 3:3e6485b2c9bb 55 lcd.printf("4. Test Temperatura ");
pablolopez89 3:3e6485b2c9bb 56 wait(1);
pablolopez89 3:3e6485b2c9bb 57
pablolopez89 3:3e6485b2c9bb 58
pablolopez89 3:3e6485b2c9bb 59 lcd.cls();
pablolopez89 3:3e6485b2c9bb 60 lcd.printf(" SELECCIONE \n");
pablolopez89 3:3e6485b2c9bb 61 lcd.printf(" UNA OPCION \n");
pablolopez89 3:3e6485b2c9bb 62 wait(2);
pablolopez89 3:3e6485b2c9bb 63
pablolopez89 3:3e6485b2c9bb 64 if(pin1==1)
pablolopez89 3:3e6485b2c9bb 65 {
pablolopez89 3:3e6485b2c9bb 66 myled=1;
pablolopez89 3:3e6485b2c9bb 67 lcd.cls();
pablolopez89 3:3e6485b2c9bb 68 lcd.printf(" Calidad Aire ");
pablolopez89 3:3e6485b2c9bb 69 lcd.printf(" ppm = 1000 ");
pablolopez89 3:3e6485b2c9bb 70 wait(2);
pablolopez89 3:3e6485b2c9bb 71
pablolopez89 3:3e6485b2c9bb 72 }
pablolopez89 3:3e6485b2c9bb 73 else if(pin1==0)
pablolopez89 3:3e6485b2c9bb 74 {
pablolopez89 3:3e6485b2c9bb 75 myled=0;
pablolopez89 3:3e6485b2c9bb 76 }
pablolopez89 3:3e6485b2c9bb 77
pablolopez89 3:3e6485b2c9bb 78 if(pin2==1)
pablolopez89 3:3e6485b2c9bb 79 {
pablolopez89 3:3e6485b2c9bb 80 myled=1;
pablolopez89 3:3e6485b2c9bb 81 lcd.cls();
pablolopez89 3:3e6485b2c9bb 82 lcd.printf(" Humedad ");
pablolopez89 3:3e6485b2c9bb 83 lcd.printf(" 15 porciento ");
pablolopez89 3:3e6485b2c9bb 84 wait(2);
pablolopez89 3:3e6485b2c9bb 85
pablolopez89 3:3e6485b2c9bb 86 }
pablolopez89 3:3e6485b2c9bb 87 else if(pin2==0)
pablolopez89 3:3e6485b2c9bb 88 {
pablolopez89 3:3e6485b2c9bb 89 myled=0;
pablolopez89 3:3e6485b2c9bb 90 }
pablolopez89 3:3e6485b2c9bb 91
pablolopez89 3:3e6485b2c9bb 92 }
pablolopez89 3:3e6485b2c9bb 93 }