Thursday, April 28, 2016

MIT App Maker Control stepper Motor from android app

Stepper Motor controlled from Android, the android app created using MIT app inventor. This app will only work for Easydriver for stepper motor, other stepper control will not work with this app.

Checkout the video to know how the app control stepper motor, this is a very simple stepper control application which you can make and understand how to control a stepper motor from android.


Arduino code for controlling stepper motor from android app:
-------------------------------------------------------------------------------------------------------------------------------

#include <AccelStepper.h>

AccelStepper stepper(AccelStepper::FULL2WIRE, 8, 9);

int spd = 1000;    // The current speed in steps/second
int sign = 1;      // Either 1, 0 or -1

void setup()

  Serial.begin(9600);
  stepper.setMaxSpeed(1000);
  stepper.setSpeed(1000);   
}

void loop()

  char c;
  if(Serial.available()) {
    c = Serial.read();
    if (c == 'f') {  // forward
      sign = 1;
    }
    if (c == 'r') {  // reverse
      sign = -1;
    }
    if (c == 's') {  // stop
      sign = 0;
    }
    if (c == '1') {  // super slow
      spd = 10;
    }
    if (c == '2') {  // slow
      spd = 100;
    }
    if (c == '3') {  // medium
      spd = 300;
    }
       if (c == '4') {  // Fast
      spd = 500;
    }
  
       if (c == '5') {  // medium
      spd = 700;
    }
  
       if (c == '6') {  // medium
      spd = 1000;
    }
    stepper.setSpeed(sign * spd);
  }
  stepper.runSpeed();
}

------------------------------------------------------------------------------------------------------------------------------   

Android app link click here

-------------------------------------------------------------------------------------------------------------------------------


MIT app inventor blocks:



No comments:

Post a Comment