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

Files at this revision

API Documentation at this revision

Comitter:
stevenjigo
Date:
Fri Oct 24 16:41:26 2014 +0000
Parent:
0:a6771cc1a056
Commit message:
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

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Sep 03 16:16:26 2013 +0000
+++ b/main.cpp	Fri Oct 24 16:41:26 2014 +0000
@@ -1,11 +1,44 @@
-// Hello World! for the TextLCD
-// EJEMPLO CON UN LCD PARA EL MODULO FRDM-KL25Z
-
 #include "mbed.h"
 #include "TextLCD.h"
 
-TextLCD lcd(PTE0, PTE1, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7
+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() {
-    lcd.printf("Hello World!\n");
+    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");
+            }
+        }
+    }
 }