ASMESDC2018
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Motor Class Reference

#include <Motor.h>

Collaboration diagram for Motor:
Collaboration graph
[legend]

Public Member Functions

 Motor (int, int, int pin_a=0, int pin_b=0)
 Default constructor. More...
 
 Motor (int, int, int, int, int, int)
 Default constructor for motor with an encoder. More...
 
int setupMotor (int, int, int pin_a=0, int pin_b=0)
 Sets up the pins of the motor class. More...
 
void run (int)
 Run the motor at the desired speed and direction or position. More...
 
long getPosition (void)
 Returns the position of the motor. More...
 
double getCurrentUsage (void)
 

Public Attributes

bool ready = false
 

Protected Attributes

MotorState state
 
MotorPins pins
 
bool ENCODER_SETUP = false
 
bool CURRENT_SENSOR_SETUP = false
 

Detailed Description

Definition at line 53 of file Motor.h.

Constructor & Destructor Documentation

Motor::Motor ( int  type,
int  pin_pwm,
int  pin_a = 0,
int  pin_b = 0 
)

Default constructor.

Author
Frederick Wachter
Date
Created: 2018-03-06

Definition at line 12 of file Motor.cpp.

Motor::Motor ( int  type,
int  pin_pwm,
int  pin_a,
int  pin_b,
int  encoder_pin_a,
int  encoder_pin_b 
)

Default constructor for motor with an encoder.

Author
Frederick Wachter
Date
Created: 2018-03-06

Definition at line 19 of file Motor.cpp.

Member Function Documentation

double Motor::getCurrentUsage ( void  )
long Motor::getPosition ( void  )

Returns the position of the motor.

Author
Frederick Wachter
Date
Created: 2018-03-06
Returns
motor_position - position of the motor

Definition at line 87 of file Motor.cpp.

void Motor::run ( int  speed)

Run the motor at the desired speed and direction or position.

Author
Frederick Wachter
Date
Created: 2018-03-06
Returns
error code

Definition at line 65 of file Motor.cpp.

void Motor::setupMotor ( int  type,
int  pin_pwm,
int  pin_a = 0,
int  pin_b = 0 
)

Sets up the pins of the motor class.

Author
Frederick Wachter
Date
Created: 2018-03-06
Returns
error code

Definition at line 31 of file Motor.cpp.

Member Data Documentation

bool Motor::CURRENT_SENSOR_SETUP = false
protected

Definition at line 104 of file Motor.h.

bool Motor::ENCODER_SETUP = false
protected

Definition at line 103 of file Motor.h.

MotorPins Motor::pins
protected

Definition at line 101 of file Motor.h.

bool Motor::ready = false

Definition at line 56 of file Motor.h.

MotorState Motor::state
protected

Definition at line 100 of file Motor.h.


The documentation for this class was generated from the following files: