This is the first version of this code, pre threading
Embed:
(wiki syntax)
Show/hide line numbers
STEPPER_MOTOR.hpp
00001 /* 00002 This is the stepper motor class and is used to control all of the motors individually 00003 */ 00004 00005 #ifndef STEPPER_MOTOR_HPP//Header Guards Prevents Multiple includes 00006 #define STEPPER_MOTOR_HPP 00007 00008 //Libraries and header includes 00009 #include "mbed.h" 00010 #include "rtos.h" 00011 class STEPPER_MOTOR //This creates a class called Led 00012 { 00013 public: 00014 00015 STEPPER_MOTOR(PinName N1, PinName N2, PinName N3, PinName N4); //Constructor 00016 ~STEPPER_MOTOR(); //Destructor 00017 void Permanent_Rotate(); 00018 void Permanent_Rotate_clock_wise(); 00019 void Permanent_Rotate_anti_clock_wise(); 00020 void Rotate_90(); 00021 void Rotate_Steps(int Steps); 00022 private: 00023 //Private member variables to prevent them being accessed externally 00024 //Data Pins 00025 bool _dir; 00026 int _step; 00027 int _Number_of_steps; 00028 DigitalOut pin1; //Pin 1 00029 DigitalOut pin2; //Pin 2 00030 DigitalOut pin3; //Pin 3 00031 DigitalOut pin4; //Pin 4 00032 00033 }; 00034 #endif//STEPPER_MOTOR_HPP
Generated on Sun Jul 17 2022 10:54:59 by
1.7.2