main.cpp

Committer:
user153739798366067129
Date:
2009-11-22
Revision:
0:b7d3acf8e391

File content as of revision 0:b7d3acf8e391:


// This program tests how many clock cycles it takes to drive the motor
// one revolution.  in this case it takes 400 clocks.
// i am using a circuit built around a STK672-330 with attached stepper.




#include "mbed.h"

DigitalOut enable(5);
DigitalOut direction(6);
DigitalOut clk(7);
int i = 0;

int main () {

        enable = 1;
        direction = 1;
        i = 0;
            while (i != 40000)   {        // run the motor 100 revolutions, 40 seconds.
            
                clk = 1;
                wait_us(500);
                clk = 0;
                wait_us(500);
                
                i += 1;
                }
                
        enable = 0;
        
        }