Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
Stepper_Motor/STEPPER_MOTOR.hpp@17:68b3fdabe4c5, 2019-02-12 (annotated)
- Committer:
- thomasmorris
- Date:
- Tue Feb 12 10:03:05 2019 +0000
- Revision:
- 17:68b3fdabe4c5
- Parent:
- STEPPER_MOTOR.hpp@16:9f98ec0ededb
- Child:
- 18:3523660f3930
Working Code;
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 | 12:d9c133b360b0 | 21 | private: |
thomasmorris | 12:d9c133b360b0 | 22 | //Private member variables to prevent them being accessed externally |
thomasmorris | 12:d9c133b360b0 | 23 | //Data Pins |
thomasmorris | 12:d9c133b360b0 | 24 | bool _dir; |
thomasmorris | 12:d9c133b360b0 | 25 | int _step; |
thomasmorris | 12:d9c133b360b0 | 26 | int _Number_of_steps; |
thomasmorris | 16:9f98ec0ededb | 27 | int _Steps_Done; |
thomasmorris | 12:d9c133b360b0 | 28 | DigitalOut pin1; //Pin 1 |
thomasmorris | 12:d9c133b360b0 | 29 | DigitalOut pin2; //Pin 2 |
thomasmorris | 12:d9c133b360b0 | 30 | DigitalOut pin3; //Pin 3 |
thomasmorris | 12:d9c133b360b0 | 31 | DigitalOut pin4; //Pin 4 |
thomasmorris | 12:d9c133b360b0 | 32 | |
thomasmorris | 12:d9c133b360b0 | 33 | }; |
thomasmorris | 12:d9c133b360b0 | 34 | #endif//STEPPER_MOTOR_HPP |