Stepper motor

Dependencies:   StepperMotorUni mbed

main.cpp

Committer:
Voldread
Date:
2015-10-08
Revision:
0:1f4ed94b7b01

File content as of revision 0:1f4ed94b7b01:

#include "mbed.h"


BusOut steps (PA_7, PB_6, PC_7, PA_9);


int main() 
{
    int i=0;
    int svar;
    
    printf("Tast 0 for med klokka, tast 1 for mot klokka\n");
    scanf("%d",&svar);

    if(svar==0)
    {
    for (i=0;i<512;i++) 
        {
        steps=0x9;
        wait_ms(5);
        steps=0xC;
        wait_ms(5);
        steps=0x6;
        wait_ms(5);
        steps=0x3;
        wait_ms(5);
        }
    }

    else if(svar==1)
   {
    for (i=0;i<512;i++) 
        {
        steps=0x3;
        wait_ms(5);
        steps=0x6;
        wait_ms(5);
        steps=0xC;
        wait_ms(5);
        steps=0x9;
        wait_ms(5);
        }
    }
 }