Basic tank-style drive robot control firmware for Freescale FRDM-K64F. Controls motors on a Dual-Full-H-Bridge with EN, like DBH-1x series, from Bluetooth serial commands

Dependencies:   mbed

MotorDriveBase.h

Committer:
Mr_What
Date:
2015-08-16
Revision:
4:7620d21baef3
Parent:
1:23d0a615756a

File content as of revision 4:7620d21baef3:

// 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 float 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 int t) = 0;  // pass in current time
  virtual void update(int t) = 0;  // check if some sort of state change needs to be processed
};