6.6 Schrittmotor bis zum Endschalter laufen lassen, Nullpunkt setzen, 10 x 100 Schritte vorwärts und in einem Lauf zurück auf die Nullposition. Zusätzlich einen Button als Notaus (Soforthalt) vorsehen.

Dependencies:   StepperMotorUni mbed

Fork of 06-13-Uebung by th.iotkit1.ch

main.cpp

Committer:
marcel1691
Date:
2015-01-03
Revision:
1:1330fe477c67
Parent:
0:ae2206213141
Child:
2:a0607b1417da

File content as of revision 1:1330fe477c67:

/**
 * Schrittmotor (unipolar) Beispiel.
 * @see http://developer.mbed.org/components/Stepper-motor-unipolar/
 *
 * Die verwendeten Pins spielen keine Rolle.
 */

#include "mbed.h"
#include "StepperMotorUni.h"

StepperMotorUni motor( D4, D5, D6, D7 );

int main()
{
    // Motordrehzahl
    motor.set_pps( 300 );

    while ( 1 ) 
    {
        motor.move_steps( 2000 );
        wait( 8 );

        motor.move_steps( -2000 );
        wait( 8 );
    }
}