Mon Hdz / Mbed 2 deprecated programa_de_ejercicio4_practica6

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
montse
Date:
Mon Jun 01 01:00:56 2020 +0000
Parent:
24:7f14b70fc9ef
Commit message:
Es un programa que manda mensajes aleatorios

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Apr 08 11:03:25 2019 +0100
+++ b/main.cpp	Mon Jun 01 01:00:56 2020 +0000
@@ -1,12 +1,49 @@
 #include "mbed.h"
+#include "C12832.h"
+
+Timer tiempoA;
+Ticker Solo;
+InterruptIn boton(p5);
+C12832 lcd(SPI_MOSI, SPI_SCK, SPI_MISO, p8, p11);
+
+//El programa tarda 20 segundos para mostrar el primer mensaje
 
-DigitalOut myled(LED1);
+int a;
+void frase(){
+      
+    lcd.locate(45, 10);
+    srand(time(NULL));
+    a=rand()%5;
+    lcd.printf("",a);
+    lcd.cls();
+    
+switch(a) 
+{
+    case 0:
+    lcd.printf("Edwin");//Bloque de instrucciones 0;
+    break;
+    case 1:
+    lcd.printf("Jair"); //Bloque de instrucciones 1;
+    break;
+    case 2:
+    lcd.printf("Karla"); //Bloque de instrucciones 2;
+    break;
+    case 3:
+    lcd.printf("Manuel"); //Bloque de instrucciones 3;
+    break;
+    case 4:
+    lcd.printf("Montse"); //Bloque de instrucciones 4;
+    break;
+}
+ lcd.copy_to_lcd();
+          }
+          
+void limpiarlcd(){
+    lcd.cls();
+                }
 
 int main() {
-    while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
-    }
-}
+        tiempoA.start();
+        Solo.attach(frase, 20);
+        boton.rise(limpiarlcd);
+           }
\ No newline at end of file