para teban jaja

Dependencies:   mbed

Revision:
0:0026a8de7cf1
diff -r 000000000000 -r 0026a8de7cf1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Apr 08 21:29:47 2016 +0000
@@ -0,0 +1,127 @@
+#include "mbed.h"
+Serial pc(USBTX,USBRX);
+
+AnalogIn pot(A0);
+DigitalIn smov(D2);
+DigitalIn btnstart(D3);
+DigitalOut b1(D4);
+DigitalOut b2(D5);
+DigitalOut c1(D6);
+DigitalOut c2(D7);
+DigitalOut led(D8);
+
+Timer timer;
+Timer timer2;
+int t,conteo2, repetrsen, btn=1, flag, b, conteo;
+float z;
+
+int main() {
+    //pc.baud(9600);  
+    
+    while(1){
+          led=1;
+         
+    if(btnstart==0){
+        btn=0;
+        }
+        
+    if(btn==0){    
+        t=(pot*1200)/1;
+        //pc.printf("tiempo deseado: %d\n", t);
+        timer.start();
+      
+        conteo=timer.read();
+        //pc.printf("conteo: %d\n", conteo);
+        
+        while(conteo<=t){
+        
+        b1=0;
+        b2=1;
+        c1=0;
+        c2=1;
+        wait(0.004);
+        
+        b1=1;
+        b2=0;
+        c1=0;
+        c2=1;
+        wait(0.004);
+        
+        b1=1;
+        b2=0;
+        c1=1;
+        c2=0;
+        wait(0.004);
+        
+        b1=0;
+        b2=1;
+        c1=1;
+        c2=0;
+        wait(0.004);
+        conteo=timer.read();
+        //pc.printf("conteo: %d\n", conteo);
+        
+        }
+        flag=1;
+        btn=1;
+        
+        //else{
+            
+        //conteo=0;
+        //t=0;
+        //}
+        
+        
+        
+        for(repetrsen=0; 19; repetrsen++){
+            //pc.printf("llego 2da parte");
+            flag=1;
+        if(smov==1 && flag==1){
+         b=1;
+         
+         if(b==1){
+         timer2.start();  
+         conteo2=timer2.read(); 
+         while(conteo2<=5){
+        //for(conteo2=0; 120; conteo2++){
+        
+        b1=0;
+        b2=1;
+        c1=0;
+        c2=1;
+        wait(0.004);
+        
+        b1=1;
+        b2=0;
+        c1=0;
+        c2=1;
+        wait(0.004);
+        
+        b1=1;
+        b2=0;
+        c1=1;
+        c2=0;
+        wait(0.004);
+        
+        b1=0;
+        b2=1;
+        c1=1;
+        c2=0;
+        wait(0.004);
+        conteo2=timer2.read(); 
+        //pc.printf("conteo2: %d\n", conteo2);
+    }        
+        }
+        }
+        wait(2);
+        //btnstart=1;
+        //timer.reset();
+            }
+            }
+                /*}else{
+                  b=0;
+                    }
+                    */
+                
+            }
+            }
\ No newline at end of file