![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
STEPPER_MOTOR.hpp@12:d9c133b360b0, 2019-02-05 (annotated)
- Committer:
- thomasmorris
- Date:
- Tue Feb 05 16:20:32 2019 +0000
- Revision:
- 12:d9c133b360b0
- Child:
- 16:9f98ec0ededb
Working LCD
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 | |
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 | 12:d9c133b360b0 | 21 | void Rotate_Steps(int Steps); |
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 | 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 |