Utility class for controlling a servo system motor.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MotorController.h Source File

MotorController.h

00001 #ifndef MOTORCONTROLLER_H
00002 #define MOTORCONTROLLER_H
00003 
00004 #include "mbed.h"
00005 #include "HBridge.h"
00006 
00007 class MotorController {
00008     public:
00009         MotorController (HBridge &motor, AnalogIn &motorInput);
00010         
00011         void start ();
00012         void stop ();
00013         
00014         void turnLeft ();
00015         void turnRight ();
00016         void setPosition (float position);
00017         
00018         float getPosition ();
00019         
00020         static const float POSITION_0  = 0.5f;
00021         static const float POSITION_1  = 1.2f;
00022         static const float POSITION_2  = 3.6f;
00023         static const float POSITION_3  = 9.7f;
00024         static const float POSITION_4  = 17.5f;
00025         static const float POSITION_5  = 25.0f;
00026         static const float POSITION_6  = 33.0f;
00027         static const float POSITION_7  = 47.7f;
00028         static const float POSITION_8  = 80.0f;
00029         static const float POSITION_9  = 100.0f;
00030         static const float POSITION_10 = 100.0f;
00031     
00032     private:
00033         HBridge &motor;
00034         AnalogIn &motorInput;
00035 };
00036 
00037 #endif