Smartcar Shield
|
#include <DualMotor.hpp>
Public Member Functions | |
DualMotor (Motor &motor1, Motor &motor2) | |
Constructs a DualMotor object The two motors will spin in the same direction and at the same "speed". More... | |
void | setSpeed (int speed) override |
Sets the motor speed and direction as the percentage of the maximum possible speed, where the sign of the argument represents the direction. More... | |
Public Member Functions inherited from Motor | |
virtual | ~Motor ()=default |
A set of two motors that should always spin in the same way while being controlled by different pins. This class should be used when you have two motors that are connected to the same driver on different pins but you want to control them as one.
Definition at line 14 of file DualMotor.hpp.
Constructs a DualMotor object The two motors will spin in the same direction and at the same "speed".
motor1 | The first motor |
motor2 | The second motor |
Definition at line 3 of file DualMotor.cpp.
|
overridevirtual |
Sets the motor speed and direction as the percentage of the maximum possible speed, where the sign of the argument represents the direction.
speed | The speed and direction within the range of [-100, 100]. -100 means that the motor is spinning at full speed towards the direction we have defined as backward. 100 interpreted as full speed forward. 0 means that the motor is at its idle/neutral state. |
Example:
Implements Motor.
Definition at line 9 of file DualMotor.cpp.