6.13 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. Anwendung: 3D Drucker, Plotter, CNC Fräse.

Dependencies:   StepperMotorUni mbed

Fork of IoTKit_StepperMotor by mc-b

Committer:
marcel1691
Date:
Sat Jan 03 14:31:09 2015 +0000
Revision:
1:1330fe477c67
Parent:
0:ae2206213141
Child:
2:a0607b1417da
Schrittmotor (unipolar) Beispiel.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
marcel1691 1:1330fe477c67 1 /**
marcel1691 1:1330fe477c67 2 * Schrittmotor (unipolar) Beispiel.
marcel1691 1:1330fe477c67 3 * @see http://developer.mbed.org/components/Stepper-motor-unipolar/
okano 0:ae2206213141 4 *
marcel1691 1:1330fe477c67 5 * Die verwendeten Pins spielen keine Rolle.
okano 0:ae2206213141 6 */
okano 0:ae2206213141 7
okano 0:ae2206213141 8 #include "mbed.h"
okano 0:ae2206213141 9 #include "StepperMotorUni.h"
okano 0:ae2206213141 10
marcel1691 1:1330fe477c67 11 StepperMotorUni motor( D4, D5, D6, D7 );
okano 0:ae2206213141 12
okano 0:ae2206213141 13 int main()
okano 0:ae2206213141 14 {
marcel1691 1:1330fe477c67 15 // Motordrehzahl
marcel1691 1:1330fe477c67 16 motor.set_pps( 300 );
okano 0:ae2206213141 17
marcel1691 1:1330fe477c67 18 while ( 1 )
marcel1691 1:1330fe477c67 19 {
marcel1691 1:1330fe477c67 20 motor.move_steps( 2000 );
marcel1691 1:1330fe477c67 21 wait( 8 );
okano 0:ae2206213141 22
marcel1691 1:1330fe477c67 23 motor.move_steps( -2000 );
marcel1691 1:1330fe477c67 24 wait( 8 );
okano 0:ae2206213141 25 }
okano 0:ae2206213141 26 }