Anim
Dependencies: BSP_DISCO_F429ZI EEPROM_DISCO_F429ZI FT810 GYRO_DISCO_F429ZI KEYPAD_DISCO_F429ZI LCD_DISCO_F429ZI PinDetect SDRAM_DISCO_F429ZI TS_DISCO_F429ZI mbed
Stepper.cpp
- Committer:
- mozillain
- Date:
- 2018-01-24
- Revision:
- 1:2ceb29686290
File content as of revision 1:2ceb29686290:
#include "Stepper.h" #include "mbed.h" stepper::stepper(PinName _en, PinName _stepPin, PinName dir):en(_en), stepPin(_stepPin), direction(dir) { } void stepper::step(int microstep, int dir, float speed) { if (dir == 1) { direction = 0; } else if (dir == 0) { direction = 1; } stepPin = 1; wait(1/speed); stepPin = 0; wait(1/speed); } void stepper::enable() { en = 0; } void stepper::disable() { en = 1; }