Plymouth ELEC351 Group T
/
ELEC351_Group_T
FINAL PROJECT isn't it
Fork of ELEC351 by
STEPPER_MOTOR.hpp@53:71f59e195f06, 2018-05-07 (annotated)
- Committer:
- thomasmorris
- Date:
- Mon May 07 15:44:34 2018 +0000
- Revision:
- 53:71f59e195f06
- Child:
- 56:bc5345bc6650
To test version of code;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 53:71f59e195f06 | 1 | /* |
thomasmorris | 53:71f59e195f06 | 2 | This is the stepper motor class and is used to control all of the motors individually |
thomasmorris | 53:71f59e195f06 | 3 | */ |
thomasmorris | 53:71f59e195f06 | 4 | |
thomasmorris | 53:71f59e195f06 | 5 | #ifndef STEPPER_MOTOR_HPP//Header Guards Prevents Multiple includes |
thomasmorris | 53:71f59e195f06 | 6 | #define STEPPER_MOTOR_HPP |
thomasmorris | 53:71f59e195f06 | 7 | |
thomasmorris | 53:71f59e195f06 | 8 | //Libraries and header includes |
thomasmorris | 53:71f59e195f06 | 9 | #include "THREADS.hpp" |
thomasmorris | 53:71f59e195f06 | 10 | #include "mbed.h" |
thomasmorris | 53:71f59e195f06 | 11 | #include "rtos.h" |
thomasmorris | 53:71f59e195f06 | 12 | #include "SERIAL.hpp" |
thomasmorris | 53:71f59e195f06 | 13 | class STEPPER_MOTOR //This creates a class called Led |
thomasmorris | 53:71f59e195f06 | 14 | { |
thomasmorris | 53:71f59e195f06 | 15 | public: |
thomasmorris | 53:71f59e195f06 | 16 | |
thomasmorris | 53:71f59e195f06 | 17 | STEPPER_MOTOR(PinName STEP, PinName DIRECTION); //Constructor |
thomasmorris | 53:71f59e195f06 | 18 | ~STEPPER_MOTOR(); //Destructor |
thomasmorris | 53:71f59e195f06 | 19 | void Permanent_Rotate(); |
thomasmorris | 53:71f59e195f06 | 20 | void Permanent_Rotate_clock_wise(); |
thomasmorris | 53:71f59e195f06 | 21 | void Permanent_Rotate_anti_clock_wise(); |
thomasmorris | 53:71f59e195f06 | 22 | void Rotate_90(); |
thomasmorris | 53:71f59e195f06 | 23 | void Rotate_Steps(int Steps, int Direction); |
thomasmorris | 53:71f59e195f06 | 24 | private: |
thomasmorris | 53:71f59e195f06 | 25 | //Private member variables to prevent them being accessed externally |
thomasmorris | 53:71f59e195f06 | 26 | //Data Pins |
thomasmorris | 53:71f59e195f06 | 27 | int _Number_of_steps; |
thomasmorris | 53:71f59e195f06 | 28 | DigitalOut _STEP; //Step |
thomasmorris | 53:71f59e195f06 | 29 | DigitalOut _DIRECTION; //Direction |
thomasmorris | 53:71f59e195f06 | 30 | |
thomasmorris | 53:71f59e195f06 | 31 | }; |
thomasmorris | 53:71f59e195f06 | 32 | #endif//STEPPER_MOTOR_HPP |