Thomas Morris / Mbed 2 deprecated Stacy

Dependencies:   mbed mbed-rtos TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers STEPPER_MOTOR.hpp Source File

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 //static float loop_wait_time = 0;
00012 class STEPPER_MOTOR                       //This creates a class called Led
00013 { 
00014 public: 
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,int Function,bool Direction);
00022     float Get_Turns();
00023     void Pause_Code();
00024     void Unpause_Code();
00025 private:    
00026     //Private member variables to prevent them being accessed externally 
00027     //Data Pins
00028     bool _Pause_Code;
00029     bool _dir;
00030     int _step;
00031     int _Number_of_steps;
00032     int _Steps_Done;
00033     DigitalOut pin1;         //Pin 1
00034     DigitalOut pin2;         //Pin 2
00035     DigitalOut pin3;         //Pin 3  
00036     DigitalOut pin4;         //Pin 4
00037 
00038 };
00039 #endif//STEPPER_MOTOR_HPP