forked from exshonda/ZumoShield
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZumoMotors.h
48 lines (37 loc) · 964 Bytes
/
ZumoMotors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*! \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