Johan Felipe Parraga / Mbed 2 deprecated ENTREGAFINALCUADRUPEDO

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
JohanParraga
Date:
Thu Nov 22 01:34:07 2018 +0000
Parent:
3:a8b858269c6b
Commit message:
trabajo final

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Nov 20 02:51:43 2018 +0000
+++ b/main.cpp	Thu Nov 22 01:34:07 2018 +0000
@@ -2,6 +2,7 @@
 #include "main.h"
 
 Timer tiempo;
+Timeout timeout;
 Serial command(USBTX, USBRX);
 
 DigitalIn entrada (PC_9);
@@ -21,10 +22,12 @@
 int Detectar();
 int tme=0;
 
+
 int main() {
     init_servo();
     init_serial();    
     debug_m("inicio \n");
+    timeout.attach(&timer_interrupt,10);
     uint32_t read_cc;   
     while(1)
     {
@@ -39,7 +42,7 @@
 }
 
 uint32_t read_command()
-{
+{ 
    
       
     char intc=command.getc();    
@@ -113,8 +116,15 @@
         wait(1); // 
     }
 
-   } 
-
+   }
+   
+void timer_interrupt(){
+    
+    debug_m("interrumpido..\n"); 
+    abajo();
+    
+timeout.attach(&timer_interrupt,10); 
+}
 
 void sensor()
 {
--- a/main.h	Tue Nov 20 02:51:43 2018 +0000
+++ b/main.h	Thu Nov 22 01:34:07 2018 +0000
@@ -16,5 +16,6 @@
 void moving2();
 void joystick();
 void sensor();
+void timer_interrupt();
 
 #endif //  MAIN_H 
\ No newline at end of file