stepper motor stop command


hello ,
i'm using following code run stepper motor. motor works fine. however, want modify code, motor rotate specific distance , stop, rather rotate continuously in loop.  really not have idea arduino coding. please me..thanks in advance!!

here's code i'm using

code: [select]

int distance = 0;

void setup() {               

  pinmode(8, output);     

  pinmode(9, output);

  digitalwrite(8, low);

  digitalwrite(9, low);

}


void loop() {

  digitalwrite(9, high);

  delaymicroseconds(200);         

  digitalwrite(9, low);

  delaymicroseconds(200);

  distance = distance + 1;

    if (distance == 3600)

  {

        if (digitalread(8 ) == low)

    {

      digitalwrite(8, high);

    }

    else

    {

      digitalwrite(8, low);

    }

       distance = 0;

        delay(500);

  }

}

can read guidelines , edit post use code-tags - won't parts of
it scrambled emoticons.


Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > stepper motor stop command


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62