intentomotorpasoapaso

Dependencies:   mbed

Fork of 00_LAB_STEPMOTOR by ferney alberto beltran molina

Revision:
1:5dfedc044f7a
Parent:
0:2890f9a09e85
--- a/stepmotor.cpp	Tue Mar 20 23:49:10 2018 +0000
+++ b/stepmotor.cpp	Wed Mar 21 01:32:33 2018 +0000
@@ -52,7 +52,7 @@
     return motorSpeed; // 
 }
 
-void stepmotor::step(uint32_t num_steps, uint8_t cw) {
+void stepmotor::step(uint32_t num_steps, bool cw) {
 // funcion para mover el motor N pasos CW o CCW   
 // num_steps  número de paso que da el motor 
 // cw =True  para dirección en sentido del reloj 
@@ -60,8 +60,8 @@
    
     uint32_t count=num_steps ;
     while(count){
-        if (cw==1)   nstep++;     
-        if (cw==0)  nstep--;
+        if (cw)   nstep++;     
+        else      nstep--;
         if (nstep>7) nstep=0;
         if (nstep<0) nstep=7;
         move();