Pololu3piPlus32U4 library
Pololu3piPlus32U4Motors.h
Go to the documentation of this file.
1 // Copyright (C) Pololu Corporation. See www.pololu.com for details.
2 
4 
5 #pragma once
6 
7 #include <stdint.h>
8 
9 namespace Pololu3piPlus32U4
10 {
11 
16 class Motors
17 {
18  public:
19 
30  static void flipLeftMotor(bool flip);
31 
41  static void flipRightMotor(bool flip);
42 
48  static void setLeftSpeed(int16_t speed);
49 
55  static void setRightSpeed(int16_t speed);
56 
65  static void setSpeeds(int16_t leftSpeed, int16_t rightSpeed);
66 
67  private:
68 
69  static inline void init()
70  {
71  static bool initialized = false;
72 
73  if (!initialized)
74  {
75  initialized = true;
76  init2();
77  }
78  }
79 
80  static void init2();
81 
82  static bool flipLeft;
83  static bool flipRight;
84 };
85 
86 }
Controls motor speed and direction on the 3pi+ 32U4.
static void setLeftSpeed(int16_t speed)
Sets the speed for the left motor.
static void flipRightMotor(bool flip)
Flips the direction of the right motor.
static void setSpeeds(int16_t leftSpeed, int16_t rightSpeed)
Sets the speeds for both motors.
static void flipLeftMotor(bool flip)
Flips the direction of the left motor.
static void setRightSpeed(int16_t speed)
Sets the speed for the right motor.
Top-level namespace for the Pololu3piPlus32U4 library.