hello wondering how write code control down functions of stepper motor 2 independent buttons. i'm new arduino , have completed basic tutorials , looking help. below current code have compiled along photo of stepper motor control digital output arduino supplies wired to.
#include <stepper.h>
#define steps 200
int btns1 =10; // pin button s1;
int btns2 =11; // pin button s2;
int ena = 4; // enable pin 1 on motor control shield;
int enb = 5; // enable pin 2 on motor control shield;
int dira = 6; // direction pin dira on motor control shield;
int dirb = 7; // direction pin dirb on motor control shield;
stepper stepper(steps, 4,5,6,7);
const int stepsperrevolution = 200; // change fit number of steps per revolution
// motor
// initialize stepper library on pins 12 , 13:
stepper mystepper(stepsperrevolution, dira, dirb);
int val1 = digitalwrite(ena, high);
int val2 = digitalwrite(enb, high);
void setup() {
// set speed @ 60 rpm:
stepper.setspeed(60);
// enable power motor
pinmode(ena, output);
digitalwrite (ena, high);
pinmode(enb, output);
digitalwrite (enb, high);
pinmode(btns1, output);
pinmode(btns2, output);
}
void loop() {
// put main code here, run repeatedly:
if (digitalread(btns1)==high){stepper.step(val1);}
if(digitalread (btns2)==high){stepper.step(val2);}
here link motor control wiring into.
thanks whomever has chance over! , engineering capstone , @ dead end.
#include <stepper.h>
#define steps 200
int btns1 =10; // pin button s1;
int btns2 =11; // pin button s2;
int ena = 4; // enable pin 1 on motor control shield;
int enb = 5; // enable pin 2 on motor control shield;
int dira = 6; // direction pin dira on motor control shield;
int dirb = 7; // direction pin dirb on motor control shield;
stepper stepper(steps, 4,5,6,7);
const int stepsperrevolution = 200; // change fit number of steps per revolution
// motor
// initialize stepper library on pins 12 , 13:
stepper mystepper(stepsperrevolution, dira, dirb);
int val1 = digitalwrite(ena, high);
int val2 = digitalwrite(enb, high);
void setup() {
// set speed @ 60 rpm:
stepper.setspeed(60);
// enable power motor
pinmode(ena, output);
digitalwrite (ena, high);
pinmode(enb, output);
digitalwrite (enb, high);
pinmode(btns1, output);
pinmode(btns2, output);
}
void loop() {
// put main code here, run repeatedly:
if (digitalread(btns1)==high){stepper.step(val1);}
if(digitalread (btns2)==high){stepper.step(val2);}
here link motor control wiring into.
thanks whomever has chance over! , engineering capstone , @ dead end.
quote
hello wondering how write code control down functions of stepper motor 2 independent buttons.have looked @ stepper motor? see motion? see down motion. steppers step, clockwise or counterclockwise.
quote
here link motor control wiring into.perhaps post picture, too.
quote
this , engineering capstone , @ dead end.one think time 1 senior in college, 1 needed with.
code: [select]
int val1 = digitalwrite(ena, high);
int val2 = digitalwrite(enb, high);
what, exactly, digitalwrite() return? how value useful?
how switches wired?
Arduino Forum > Using Arduino > Programming Questions > How to Control a Stepper Motor
arduino
Comments
Post a Comment