Line | |
---|
1 | /*! \file ZumoMotors.h
|
---|
2 | *
|
---|
3 | * See the ZumoMotors class reference for more information about this library.
|
---|
4 | *
|
---|
5 | * \class ZumoMotors ZumoMotors.h
|
---|
6 | * \brief Control motor speed and direction
|
---|
7 | *
|
---|
8 | */
|
---|
9 |
|
---|
10 | #ifndef ZumoMotors_h
|
---|
11 | #define ZumoMotors_h
|
---|
12 |
|
---|
13 | #include <Arduino.h>
|
---|
14 |
|
---|
15 | class ZumoMotors
|
---|
16 | {
|
---|
17 | public:
|
---|
18 |
|
---|
19 | // constructor (doesn't do anything)
|
---|
20 | ZumoMotors();
|
---|
21 |
|
---|
22 | // enable/disable flipping of motors
|
---|
23 | static void flipLeftMotor(boolean flip);
|
---|
24 | static void flipRightMotor(boolean flip);
|
---|
25 |
|
---|
26 | // set speed for left, right, or both motors
|
---|
27 | static void setLeftSpeed(int speed);
|
---|
28 | static void setRightSpeed(int speed);
|
---|
29 | static void setSpeeds(int leftSpeed, int rightSpeed);
|
---|
30 |
|
---|
31 | private:
|
---|
32 |
|
---|
33 | static inline void init()
|
---|
34 | {
|
---|
35 | static boolean initialized = false;
|
---|
36 |
|
---|
37 | if (!initialized)
|
---|
38 | {
|
---|
39 | initialized = true;
|
---|
40 | init2();
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | // initializes timer1 for proper PWM generation
|
---|
45 | static void init2();
|
---|
46 | };
|
---|
47 |
|
---|
48 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.