Committer:
inst
Date:
Wed Oct 14 03:50:40 2015 +0000
Revision:
2:0f03a5729afc
Parent:
1:e06cf312e9f0

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
inst 0:d4e07340fb0e 1 #ifndef INCLUDED_I2C_SERVO_H
inst 0:d4e07340fb0e 2 #define INCLUDED_I2C_SERVO_H
inst 0:d4e07340fb0e 3
inst 0:d4e07340fb0e 4 #include "mbed.h"
inst 0:d4e07340fb0e 5 #include "I2CDevice.h"
inst 0:d4e07340fb0e 6
inst 0:d4e07340fb0e 7 class I2CServo : public I2CDevice{
inst 0:d4e07340fb0e 8 public:
inst 2:0f03a5729afc 9 I2CServo( char address );
inst 0:d4e07340fb0e 10
inst 2:0f03a5729afc 11 void setTargetPosition( float p );
inst 0:d4e07340fb0e 12
inst 2:0f03a5729afc 13 bool hasStopped(){
inst 2:0f03a5729afc 14 return mHasStopped;
inst 1:e06cf312e9f0 15 }
inst 1:e06cf312e9f0 16 float getPosition(){
inst 1:e06cf312e9f0 17 return mPosition;
inst 1:e06cf312e9f0 18 }
inst 1:e06cf312e9f0 19
inst 2:0f03a5729afc 20 void stop(){
inst 2:0f03a5729afc 21 mTargetPosition = mPosition;
inst 2:0f03a5729afc 22 mHasStopped = true;
inst 2:0f03a5729afc 23 }
inst 2:0f03a5729afc 24
inst 2:0f03a5729afc 25 virtual int write();
inst 2:0f03a5729afc 26 virtual int read();
inst 1:e06cf312e9f0 27
inst 0:d4e07340fb0e 28 private:
inst 2:0f03a5729afc 29 static const float mAllowableError;
inst 1:e06cf312e9f0 30 float mTargetPosition;
inst 2:0f03a5729afc 31 bool mHasStopped;
inst 1:e06cf312e9f0 32 float mPosition;
inst 0:d4e07340fb0e 33 };
inst 0:d4e07340fb0e 34
inst 0:d4e07340fb0e 35 #endif