ISISA-Zacatenco / Mbed 2 deprecated motor_bip_pot

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Javierdf
Date:
Tue Nov 19 05:10:28 2019 +0000
Commit message:
motor bipolar potenciometro

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:10:28 2019 +0000
@@ -0,0 +1,27 @@
+// programa para leer un pot a traves de pin analogico y hacer solo un numero determiando de pasos de acuerdo a la lectura del pot
+#include "mbed.h"
+
+BusOut M1(D2,D3,D4,D5);
+AnalogIn a1(A5);
+char pos[4]={0x05,0x06,0x0A,0x09};
+int i=0;
+
+int main()
+{
+  int x,y;
+  
+// factor de multiplicacion 170 puede variar de acuerdo al numero de ciclos que se desea hacer
+// un ciclo son 4pasos = 1rpm
+ y=170*a1.read();
+
+      for(x=0;x<y;x++){
+       
+        M1=pos[i];
+        wait(0.01);
+        i++;
+        if(i==4)
+        i=0;
+        
+    
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 19 05:10:28 2019 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/e2bfab296f20
\ No newline at end of file