motor bipolar ida y vuelta

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Javierdf
Date:
Tue Nov 19 05:09:49 2019 +0000
Commit message:
motor bipolar ida y vuelta;

Changed in this revision

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Nov 19 05:09:49 2019 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+
+BusOut M1(D2,D3,D4,D5);
+Serial pc(USBTX,USBRX);
+//DigitalOut ledG(D13);
+//DigitalOut ledB(D4);
+char pos1[4]={0x05,0x06,0x0A,0x09};
+char pos2[4]={0x0A,0x06,0x05,0x09};
+int i=0,u=0;
+int x=0;
+
+
+int main()
+{
+
+while(1){
+
+        switch(pc.getc())
+        {
+        
+        case 'a':
+        for(x=0;x<5;x++)
+        {        
+        M1=pos1[i];
+        wait(0.005);
+        i++;
+        if(i==4)
+         i=0;
+         }
+         x=0;
+        break;
+        
+     
+        case 's':
+       for(x=0;x<5;x++)
+       {
+        M1=pos2[u];
+        wait(0.005);
+        u++;
+        if(u==4)
+         u=0;
+         } 
+         x=0; 
+        break;
+            
+        } 
+    
+    }
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 19 05:09:49 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec
\ No newline at end of file