ferney alberto beltran molina
/
00_LAB_STEPMOTOR
E
stepmotor.h@1:5dfedc044f7a, 2018-03-21 (annotated)
- Committer:
- fabeltranm
- Date:
- Wed Mar 21 01:32:33 2018 +0000
- Revision:
- 1:5dfedc044f7a
- Parent:
- 0:2890f9a09e85
bool cw
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fabeltranm | 0:2890f9a09e85 | 1 | |
fabeltranm | 0:2890f9a09e85 | 2 | /****************************************************************************** |
fabeltranm | 0:2890f9a09e85 | 3 | Desarrollado por ferney beltran fbeltran@ecci.edu.co |
fabeltranm | 0:2890f9a09e85 | 4 | |
fabeltranm | 0:2890f9a09e85 | 5 | libreria ejemplo para el motor paso a paso unipolar de 4 fases |
fabeltranm | 0:2890f9a09e85 | 6 | |
fabeltranm | 0:2890f9a09e85 | 7 | ******************************************************************************/ |
fabeltranm | 0:2890f9a09e85 | 8 | |
fabeltranm | 0:2890f9a09e85 | 9 | //***************************************************************************** |
fabeltranm | 0:2890f9a09e85 | 10 | |
fabeltranm | 0:2890f9a09e85 | 11 | #ifndef STEP_MOTOR_H |
fabeltranm | 0:2890f9a09e85 | 12 | #define STEP_MOTOR_H |
fabeltranm | 0:2890f9a09e85 | 13 | |
fabeltranm | 0:2890f9a09e85 | 14 | #include "mbed.h" |
fabeltranm | 0:2890f9a09e85 | 15 | |
fabeltranm | 0:2890f9a09e85 | 16 | class stepmotor { |
fabeltranm | 0:2890f9a09e85 | 17 | public: |
fabeltranm | 0:2890f9a09e85 | 18 | |
fabeltranm | 0:2890f9a09e85 | 19 | stepmotor(PinName in1, PinName in2, PinName in3, PinName in4); |
fabeltranm | 1:5dfedc044f7a | 20 | void step(uint32_t num_steps,bool cw); |
fabeltranm | 0:2890f9a09e85 | 21 | void set_speed(int speed); |
fabeltranm | 0:2890f9a09e85 | 22 | uint32_t get_speed(); |
fabeltranm | 0:2890f9a09e85 | 23 | private: |
fabeltranm | 0:2890f9a09e85 | 24 | BusOut motor_out; |
fabeltranm | 0:2890f9a09e85 | 25 | uint32_t motorSpeed; |
fabeltranm | 0:2890f9a09e85 | 26 | int8_t nstep; |
fabeltranm | 0:2890f9a09e85 | 27 | |
fabeltranm | 0:2890f9a09e85 | 28 | void move(); |
fabeltranm | 0:2890f9a09e85 | 29 | }; |
fabeltranm | 0:2890f9a09e85 | 30 | |
fabeltranm | 0:2890f9a09e85 | 31 | #endif |