Romi32U4 library
Romi32U4Motors.h
Go to the documentation of this file.
1 // Copyright Pololu Corporation. For more information, see http://www.pololu.com/
2 
5 #pragma once
6 
7 #include <stdint.h>
8 
14 {
15  public:
16 
27  static void flipLeftMotor(bool flip);
28 
38  static void flipRightMotor(bool flip);
39 
45  static void setLeftSpeed(int16_t speed);
46 
52  static void setRightSpeed(int16_t speed);
53 
62  static void setSpeeds(int16_t leftSpeed, int16_t rightSpeed);
63 
77  static void allowTurbo(bool turbo);
78 
79  private:
80 
81  static inline void init()
82  {
83  static bool initialized = false;
84 
85  if (!initialized)
86  {
87  initialized = true;
88  init2();
89  }
90  }
91 
92  static void init2();
93 
94  static int16_t maxSpeed;
95  static bool flipLeft;
96  static bool flipRight;
97 };
static void flipRightMotor(bool flip)
Flips the direction of the right motor.
Controls motor speed and direction on the Romi 32U4.
static void setRightSpeed(int16_t speed)
Sets the speed for the right motor.
static void flipLeftMotor(bool flip)
Flips the direction of the left motor.
static void allowTurbo(bool turbo)
Turns turbo mode on or off.
static void setSpeeds(int16_t leftSpeed, int16_t rightSpeed)
Sets the speed for both motors.
static void setLeftSpeed(int16_t speed)
Sets the speed for the left motor.