para el ventilador

Dependencies:   QEI FastPWM

stepper_motor_driver.cpp

Committer:
miguelangel_2511
Date:
2020-04-11
Revision:
0:9d0b9785d3d6
Child:
1:aa5df1878126

File content as of revision 0:9d0b9785d3d6:


#include "mbed.h"
#include "project_defines.h"
#include "stepper_motor_driver.h"
#include "buttons.h"

PwmOut stepper_pulse(STEPPER_PULSE_PIN);
DigitalOut  stepper_en(STEPPER_ENABLE_PIN);
DigitalOut  stepper_dir(STEPPER_DIRECTION_PIN);


uint8_t stepper_motor_state = STEPPER_MOTOR_GO_HOME ;



void Stepper_Motor_Go_Home(void){
    
    stepper_en = 1;
    stepper_dir = 0;
    
    if(buttons & (1 << LIMIT_SW_01)){
        stepper_motor_state = STEPPER_MOTOR_GO_AHEAD;
    }
}


void Stepper_Motor_Go_Ahead(void){
    stepper_en = 1;
    stepper_dir = 1;
    wait_ms(1200);
    stepper_motor_state = STEPPER_MOTOR_GO_HOME;
}