FT810 DISCO-429ZI
Dependencies: BSP_DISCO_F429ZI EEPROM_DISCO_F429ZI FT810_DISCO-F429ZI GYRO_DISCO_F429ZI KEYPAD_DISCO_F429ZI LCD_DISCO_F429ZI SDRAM_DISCO_F429ZI TS_DISCO_F429ZI mbed
Stepper.cpp
00001 #include "Stepper.h" 00002 #include "mbed.h" 00003 00004 stepper::stepper(PinName _en, PinName _stepPin, PinName dir):en(_en), 00005 stepPin(_stepPin), 00006 direction(dir) 00007 { 00008 } 00009 00010 void stepper::step(int microstep, int dir, float speed) 00011 { 00012 if (dir == 1) { 00013 direction = 0; 00014 } else if (dir == 0) { 00015 direction = 1; 00016 } 00017 00018 stepPin = 1; 00019 wait(1/speed); 00020 stepPin = 0; 00021 wait(1/speed); 00022 } 00023 00024 void stepper::enable() 00025 { 00026 en = 0; 00027 } 00028 00029 void stepper::disable() 00030 { 00031 en = 1; 00032 }
Generated on Thu Jul 14 2022 01:07:02 by 1.7.2