Programa dado para parpadear un LED al oprimir un boton

Dependencies:   Debounced mbed

Files at this revision

API Documentation at this revision

Comitter:
diego_carvajal
Date:
Wed Mar 26 16:01:46 2014 +0000
Commit message:
Programa dado para parpadear un LED de acuerdo a la presi?n de un Boton

Changed in this revision

Debounced.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 14f6a98bb918 Debounced.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Debounced.lib	Wed Mar 26 16:01:46 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/WarwickRacing/code/Debounced/#8992c13bbb9b
diff -r 000000000000 -r 14f6a98bb918 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 26 16:01:46 2014 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+# include "DebouncedIn.h"
+
+// Programa para encender un led, si se hace presión sobre un pulsador
+// El led va a encender con mayor duración a medida que se pulse
+
+DigitalOut LED(LED1);
+DebouncedIn PULSADOR(PTC12);
+
+
+float c = 0;
+
+int main ()
+{
+
+    while (1)
+        {
+        
+                if (c<10)
+                {
+                
+                        LED=!LED;
+                        if (PULSADOR.falling())
+                            {
+                                LED == 1;
+                                c = c+0.1;
+                               
+                            }      
+                             
+                        
+                        
+                      wait (c);
+                 }  
+                else 
+                {
+                      c=0;
+                      
+                }
+              
+          }     
+}
diff -r 000000000000 -r 14f6a98bb918 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Mar 26 16:01:46 2014 +0000
@@ -0,0 +1,1 @@
+http://world3.dev.mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43
\ No newline at end of file