para el ventilador

Dependencies:   QEI FastPWM

Revision:
0:9d0b9785d3d6
Child:
1:aa5df1878126
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stepper_motor_driver.cpp	Sat Apr 11 22:53:05 2020 +0000
@@ -0,0 +1,32 @@
+
+#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;
+}   
\ No newline at end of file