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 */
10 #ifndef ZumoMotors_h
11 #define ZumoMotors_h
13 #include <Energia.h>
15 class ZumoMotors
16 {
17 public:
19 // constructor (doesn't do anything)
20 ZumoMotors();
22 // enable/disable flipping of motors
23 static void flipLeftMotor(boolean flip);
24 static void flipRightMotor(boolean flip);
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);
31 private:
33 static inline void init()
34 {
35 static boolean initialized = false;
37 if (!initialized)
38 {
39 initialized = true;
40 init2();
41 }
42 }
44 // initializes timer1 for proper PWM generation
45 static void init2();
46 };
48 #endif