intentomotorpasoapaso

Dependencies:   mbed

Fork of 00_LAB_STEPMOTOR by ferney alberto beltran molina

Revision:
0:2890f9a09e85
Child:
1:5dfedc044f7a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 20 23:49:10 2018 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+#include "stepmotor.h"
+
+stepmotor smotor1(D9,D10,D11,D12);
+Serial pc(USBTX,USBRX);
+int main() {
+    uint32_t speed=1500;
+    uint8_t cw=1;
+    while(1)
+    {
+        smotor1.set_speed(speed);
+       
+
+        pc.printf("velocidad del motor:  %i, %f rpm, CW=%d  \n",smotor1.get_speed(), (60/((smotor1.get_speed()*4.096)/1000)),cw);
+        
+        smotor1.step(4096,cw);
+        
+        cw=~cw &(0x01);
+        speed=speed+200;
+        if (speed > 10000)speed =1500;
+        wait(1);
+    }
+}