mirror of
https://github.com/KevinMidboe/Arduino.git
synced 2025-10-29 17:40:11 +00:00
48 lines
964 B
C++
Executable File
48 lines
964 B
C++
Executable File
/*! \file ZumoMotors.h
|
|
*
|
|
* See the ZumoMotors class reference for more information about this library.
|
|
*
|
|
* \class ZumoMotors ZumoMotors.h
|
|
* \brief Control motor speed and direction
|
|
*
|
|
*/
|
|
|
|
#ifndef ZumoMotors_h
|
|
#define ZumoMotors_h
|
|
|
|
#include <Arduino.h>
|
|
|
|
class ZumoMotors
|
|
{
|
|
public:
|
|
|
|
// constructor (doesn't do anything)
|
|
ZumoMotors();
|
|
|
|
// enable/disable flipping of motors
|
|
static void flipLeftMotor(boolean flip);
|
|
static void flipRightMotor(boolean flip);
|
|
|
|
// set speed for left, right, or both motors
|
|
static void setLeftSpeed(int speed);
|
|
static void setRightSpeed(int speed);
|
|
static void setSpeeds(int leftSpeed, int rightSpeed);
|
|
|
|
private:
|
|
|
|
static inline void init()
|
|
{
|
|
static boolean initialized = false;
|
|
|
|
if (!initialized)
|
|
{
|
|
initialized = true;
|
|
init2();
|
|
}
|
|
}
|
|
|
|
// initializes timer1 for proper PWM generation
|
|
static void init2();
|
|
};
|
|
|
|
#endif |