![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
Stepper_Motor/STEPPER_MOTOR.hpp@30:a35f0ab97a65, 2019-04-04 (annotated)
- Committer:
- thomasmorris
- Date:
- Thu Apr 04 10:52:22 2019 +0000
- Revision:
- 30:a35f0ab97a65
- Parent:
- 29:f3b1387c81f1
Testing 1;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 12:d9c133b360b0 | 1 | /* |
thomasmorris | 12:d9c133b360b0 | 2 | This is the stepper motor class and is used to control all of the motors individually |
thomasmorris | 12:d9c133b360b0 | 3 | */ |
thomasmorris | 12:d9c133b360b0 | 4 | |
thomasmorris | 12:d9c133b360b0 | 5 | #ifndef STEPPER_MOTOR_HPP//Header Guards Prevents Multiple includes |
thomasmorris | 12:d9c133b360b0 | 6 | #define STEPPER_MOTOR_HPP |
thomasmorris | 12:d9c133b360b0 | 7 | |
thomasmorris | 12:d9c133b360b0 | 8 | //Libraries and header includes |
thomasmorris | 12:d9c133b360b0 | 9 | #include "mbed.h" |
thomasmorris | 12:d9c133b360b0 | 10 | #include "rtos.h" |
thomasmorris | 28:3193157ebb0c | 11 | //static float loop_wait_time = 0; |
thomasmorris | 12:d9c133b360b0 | 12 | class STEPPER_MOTOR //This creates a class called Led |
thomasmorris | 12:d9c133b360b0 | 13 | { |
thomasmorris | 12:d9c133b360b0 | 14 | public: |
thomasmorris | 12:d9c133b360b0 | 15 | STEPPER_MOTOR(PinName N1, PinName N2, PinName N3, PinName N4); //Constructor |
thomasmorris | 12:d9c133b360b0 | 16 | ~STEPPER_MOTOR(); //Destructor |
thomasmorris | 12:d9c133b360b0 | 17 | void Permanent_Rotate(); |
thomasmorris | 12:d9c133b360b0 | 18 | void Permanent_Rotate_clock_wise(); |
thomasmorris | 12:d9c133b360b0 | 19 | void Permanent_Rotate_anti_clock_wise(); |
thomasmorris | 12:d9c133b360b0 | 20 | void Rotate_90(); |
thomasmorris | 29:f3b1387c81f1 | 21 | void Rotate_Steps(int Steps,int Function,bool Direction); |
thomasmorris | 18:3523660f3930 | 22 | float Get_Turns(); |
thomasmorris | 23:07a368f2cdb1 | 23 | void Pause_Code(); |
thomasmorris | 23:07a368f2cdb1 | 24 | void Unpause_Code(); |
thomasmorris | 12:d9c133b360b0 | 25 | private: |
thomasmorris | 12:d9c133b360b0 | 26 | //Private member variables to prevent them being accessed externally |
thomasmorris | 12:d9c133b360b0 | 27 | //Data Pins |
thomasmorris | 23:07a368f2cdb1 | 28 | bool _Pause_Code; |
thomasmorris | 12:d9c133b360b0 | 29 | bool _dir; |
thomasmorris | 12:d9c133b360b0 | 30 | int _step; |
thomasmorris | 12:d9c133b360b0 | 31 | int _Number_of_steps; |
thomasmorris | 16:9f98ec0ededb | 32 | int _Steps_Done; |
thomasmorris | 12:d9c133b360b0 | 33 | DigitalOut pin1; //Pin 1 |
thomasmorris | 12:d9c133b360b0 | 34 | DigitalOut pin2; //Pin 2 |
thomasmorris | 12:d9c133b360b0 | 35 | DigitalOut pin3; //Pin 3 |
thomasmorris | 12:d9c133b360b0 | 36 | DigitalOut pin4; //Pin 4 |
thomasmorris | 12:d9c133b360b0 | 37 | |
thomasmorris | 12:d9c133b360b0 | 38 | }; |
thomasmorris | 12:d9c133b360b0 | 39 | #endif//STEPPER_MOTOR_HPP |