This code allows obtain the values sent from a bluetooth module and in the same time allows see in a LCD 16*2 the state (on or off) of a Led of the Freescale

Dependencies:   TextLCD mbed

Fork of LCD_FRDM_KL25Z by Gustavo Ramirez

main.cpp

Committer:
stevenjigo
Date:
2014-10-24
Revision:
1:23e44d676994
Parent:
0:a6771cc1a056

File content as of revision 1:23e44d676994:

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

Serial device(D14, D15);  // tx, rx
DigitalOut L1(LED1);

TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7

char value;

int main() {
    L1=1;
    lcd.locate(0,0);
    lcd.printf("Comunicacion");
    lcd.locate(0,1);
    lcd.printf("Bluetooth");
    wait(2);
    lcd.cls();
    lcd.printf("Procesadores");
    lcd.locate(0,1);
    lcd.printf("Oscar y Steven");
    wait(2);
    lcd.cls();
    lcd.locate(0,0);
    lcd.printf("Estado: Off");
    while(1){
        if(device.readable()){
            value=device.getc();
            lcd.cls();
            lcd.locate(0,0);
            lcd.printf("Estado: ");
            if(value=='1'){
                L1=0;
                lcd.locate(8,0);
                lcd.printf("On");
            }
            if(value=='2'){
                L1=1;
                lcd.locate(8,0);
                lcd.printf("Off");
            }
        }
    }
}