I2CMotor.h
- Committer:
- inst
- Date:
- 2015-08-21
- Revision:
- 1:46cf8d086b38
- Parent:
- 0:89910534fad4
- Child:
- 2:5b17e7dffb3d
File content as of revision 1:46cf8d086b38:
#ifndef INCLUDED_I2C_MOTOR_H #define INCLUDED_I2C_MOTOR_H #include "I2CDevice.h" #include "mbed.h" class I2CMotor : public I2CDevice{ public: enum ActionType{ FORWARD, REVERSE, BRAKE, RELEASE, }; I2CMotor( char address ); void setActionType( ActionType action ){ mActionType = action; } void setDuty( float duty ){ if ( duty > mMaxDuty ){ duty = mMaxDuty; } else if ( duty < mMinDuty ){ duty = mMinDuty; } mDuty = duty; } ActionType getActionType() const{ return mActionType; } float getDuty() const{ return mDuty; } float getMaxDuty() const{ return mMaxDuty; } float getMinDuty() const{ return mMinDuty; } protected: virtual void write(); virtual void read(){} private: ActionType mActionType; float mDuty; float mMaxDuty; float mMinDuty; }; #endif