Mon Hdz / Mbed 2 deprecated Ej3_P5

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
montse
Date:
Sun Apr 12 02:49:53 2020 +0000
Parent:
26:0abd50bf69ae
Commit message:
Ejercicio 3 correspondiente a la practica 5.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Apr 11 20:25:47 2020 +0000
+++ b/main.cpp	Sun Apr 12 02:49:53 2020 +0000
@@ -4,30 +4,32 @@
 presionado o botón no presionado. (Utilizar una función con argumentos y sin retorno de valor)*/
 
 Serial com1(USBTX, USBRX);
-
+DigitalIn boton1(PTC6);
 
 void Boton(int Si, int No)
 {
     int pulsado;
-    
+    int sinpulsar;
     pulsado = Si;
-    
-    com1.printf("El boton esta pulsado \n", pulsado);
-    
-    
-    int sinpulsar;
-    
     sinpulsar = No;
     
+    if(Si==1)
+    {
+    com1.printf("El boton esta pulsado \n", pulsado);
+    }
+    
+    else
+    {
     com1.printf("El boton no esta pulsado \n", sinpulsar);
-
+     }
+ 
 }
-
+ 
 int main ()
 {
     int e1,e2;
     
-    e1 = 0;
+    e1 = boton1;
     e2 = !e1;
     
     Boton(e1,e2);