![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
Stepper_Motor/STEPPER_MOTOR.hpp@18:3523660f3930, 2019-02-12 (annotated)
- Committer:
- thomasmorris
- Date:
- Tue Feb 12 10:12:08 2019 +0000
- Revision:
- 18:3523660f3930
- Parent:
- 17:68b3fdabe4c5
- Child:
- 23:07a368f2cdb1
Coiling Rig;
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 | 12:d9c133b360b0 | 11 | class STEPPER_MOTOR //This creates a class called Led |
thomasmorris | 12:d9c133b360b0 | 12 | { |
thomasmorris | 12:d9c133b360b0 | 13 | public: |
thomasmorris | 12:d9c133b360b0 | 14 | STEPPER_MOTOR(PinName N1, PinName N2, PinName N3, PinName N4); //Constructor |
thomasmorris | 12:d9c133b360b0 | 15 | ~STEPPER_MOTOR(); //Destructor |
thomasmorris | 12:d9c133b360b0 | 16 | void Permanent_Rotate(); |
thomasmorris | 12:d9c133b360b0 | 17 | void Permanent_Rotate_clock_wise(); |
thomasmorris | 12:d9c133b360b0 | 18 | void Permanent_Rotate_anti_clock_wise(); |
thomasmorris | 12:d9c133b360b0 | 19 | void Rotate_90(); |
thomasmorris | 12:d9c133b360b0 | 20 | void Rotate_Steps(int Steps); |
thomasmorris | 18:3523660f3930 | 21 | float Get_Turns(); |
thomasmorris | 12:d9c133b360b0 | 22 | private: |
thomasmorris | 12:d9c133b360b0 | 23 | //Private member variables to prevent them being accessed externally |
thomasmorris | 12:d9c133b360b0 | 24 | //Data Pins |
thomasmorris | 12:d9c133b360b0 | 25 | bool _dir; |
thomasmorris | 12:d9c133b360b0 | 26 | int _step; |
thomasmorris | 12:d9c133b360b0 | 27 | int _Number_of_steps; |
thomasmorris | 16:9f98ec0ededb | 28 | int _Steps_Done; |
thomasmorris | 12:d9c133b360b0 | 29 | DigitalOut pin1; //Pin 1 |
thomasmorris | 12:d9c133b360b0 | 30 | DigitalOut pin2; //Pin 2 |
thomasmorris | 12:d9c133b360b0 | 31 | DigitalOut pin3; //Pin 3 |
thomasmorris | 12:d9c133b360b0 | 32 | DigitalOut pin4; //Pin 4 |
thomasmorris | 12:d9c133b360b0 | 33 | |
thomasmorris | 12:d9c133b360b0 | 34 | }; |
thomasmorris | 12:d9c133b360b0 | 35 | #endif//STEPPER_MOTOR_HPP |