Aaron Birenboim / Mbed 2 deprecated TankDrive Featured

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MotorDriveBase.h Source File

MotorDriveBase.h

00001 // Generic interface for "standard" H-Bridge motor driver
00002 
00003 class MotorDriveBase
00004 {
00005   virtual void stop() = 0;
00006   virtual void emergencyStop() = 0;
00007 
00008   
00009   // Set speed -MAX_PWM for max reverse, MAX_PWM for max forward
00010   inline void setSpeed(const float spdReq)
00011   {
00012     setSpeed(spdReq,millis());
00013   }
00014 
00015   // many (all?) drivers may have some mode transition times and pauses.
00016   // use these to indicate current time, to avoid repeated calls to millis()
00017   virtual void setSpeed(const float spd, const int t) = 0;  // pass in current time
00018   virtual void update(int t) = 0;  // check if some sort of state change needs to be processed
00019 };