Stepper Motor Stop Switch using IR Speed Motion Sensor


dear all,

i new both arduino , programming. want develop stepper motor application involves 360 degree forward , backward motion. using adafruit stepper motor driver this. till have managed move stepper motor in clockwise , anticlockwise direction.

i want stepper motor start specific point whenever process (arduino) starts. tried hook ir speed motion sensor (got friend. gives ttl output, when circuit breaks shows value around 800 when circuit closes around 45) not able use switch stepper motor.

i can understand might silly question , sincere apologies that. if can me or suggest me other alternative can used switch stepper motor.

thank you

following code.

#include <afmotor.h>
af_stepper stepper(200,2);
int pospin=a0;
int readvalue;
int i=1;

void setup() {

  stepper.setspeed(5);
  pinmode(pospin,input);
  analogread(pospin);
  readvalue = analogread(pospin);
 

    if(readvalue>100)
    {
       readvalue = analogread(pospin);
       stepper.step(i,forward,microstep);
       i=i+1;
       delay(100);
    }
    else
    {
     delay(100);
     stepper.release();
    }

}

void loop() {
 
  stepper.step(200, backward, interleave);
  stepper.step(200, forward, microstep);

}

quote
i want stepper motor start specific point whenever process (arduino) starts.
do mean want set shaft of stepper specific angle @ start?

is there moving connected motor (i assume so)? typically use limit switch , turn motor in 1 direction until switch gets activated mobile part hitting switch. know are, @ reference point , can count steps "home" position

a speed sensor, name implies, measuring speed not position


Arduino Forum > Using Arduino > Programming Questions > Stepper Motor Stop Switch using IR Speed Motion Sensor


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor