Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers I2CServo.h Source File

I2CServo.h

00001 #ifndef INCLUDED_I2C_SERVO_H
00002 #define INCLUDED_I2C_SERVO_H
00003 
00004 #include "mbed.h"
00005 #include "I2CDevice.h"
00006 
00007 class I2CServo : public I2CDevice{
00008 public:
00009     I2CServo( char address );
00010     
00011     void setTargetPosition( float p );
00012     
00013     bool hasStopped(){
00014         return mHasStopped;
00015     }
00016     float getPosition(){
00017         return mPosition;
00018     }
00019     
00020     void stop(){
00021         mTargetPosition = mPosition;
00022         mHasStopped = true;
00023     }
00024     
00025     virtual int write();
00026     virtual int read();
00027     
00028 private:
00029     static const float mAllowableError;
00030     float mTargetPosition;
00031     bool mHasStopped;
00032     float mPosition;
00033 };
00034 
00035 #endif