Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MotorDriveBase.h
- Committer:
- Mr_What
- Date:
- 2015-07-28
- Revision:
- 0:41ca27337c2b
- Child:
- 1:23d0a615756a
File content as of revision 0:41ca27337c2b:
// Generic interface for "standard" H-Bridge motor driver
class MotorDriveBase
{
virtual void stop() = 0;
virtual void emergencyStop() = 0;
// Set speed -MAX_PWM for max reverse, MAX_PWM for max forward
inline void setSpeed(const int spdReq)
{
setSpeed(spdReq,millis());
}
// many (all?) drivers may have some mode transition times and pauses.
// use these to indicate current time, to avoid repeated calls to millis()
virtual void setSpeed(const float spd, const long t) = 0; // pass in current time
virtual void update(long t) = 0; // check if some sort of state change needs to be processed
};