Schrittmotor Beispiel
Dependencies: StepperMotorUni mbed
main.cpp
00001 /** Schrittmotor Beispiel 00002 Schrittmotor an Stepper 1 mit rotem Kabel nach unten (+) einstecken. 00003 */ 00004 #include "mbed.h" 00005 #include "StepperMotorUni.h" 00006 00007 StepperMotorUni motor( D5, D4, D3, D2 ); 00008 00009 int main() 00010 { 00011 // Motordrehzahl 00012 printf( "Schrittmotor Test\n" ); 00013 motor.set_pps( 150 ); 00014 00015 while ( 1 ) 00016 { 00017 printf( "vorwaerts\n" ); 00018 motor.move_steps( 1024 ); // halbe Umdrehung (180°) 00019 wait( 7.5 ); 00020 00021 printf( "rueckwaerts\n" ); 00022 motor.move_steps( -1024 ); 00023 wait( 7.5 ); 00024 } 00025 }
Generated on Thu Jul 14 2022 14:30:13 by 1.7.2