Class Drive handels the Driving-System and provides basic functions.
More...
#include <Drive.h>
Class Drive handels the Driving-System and provides basic functions.
Definition at line 42 of file Drive.h.
◆ Direction
Direction enum holds all possible directions.
Enumerator |
---|
Left | Left.
|
Right | Right.
|
Forward | Forward.
|
Backward | Backward.
|
Definition at line 49 of file Drive.h.
◆ Drive()
Drive::Drive |
( |
const int |
MotorPortRight, |
|
|
const int |
MotorPortLeft |
|
) |
| |
Construct a new Drive object https://www.adafruit.com/product/2927.
- Parameters
-
MotorPortRight | - Port where the right Motor is connected on the MotorShield |
MotorPortLeft | - Port where the left Motor is connected on the MotorShield |
- Todo:
- Add a variable to compensate for differences in engine speed with the same control
Definition at line 21 of file Drive.cpp.
◆ drive()
void Drive::drive |
( |
Direction |
direction, |
|
|
unsigned int |
speed |
|
) |
| |
Drive straight Forwards or Backwards.
- Parameters
-
direction | - Movingdirection Forward or Backward |
speed | - Speed between 0 and 255 |
Definition at line 29 of file Drive.cpp.
◆ turn()
void Drive::turn |
( |
Direction |
direction, |
|
|
unsigned int |
speed |
|
) |
| |
Turn left or right. Speed will add to one Motor's actual speed and substract from the others depenig on which side it turns.
- Parameters
-
direction | - left or right |
speed | - Speed between 0 and 255 |
Definition at line 53 of file Drive.cpp.
◆ turnonpoint()
void Drive::turnonpoint |
( |
Direction |
direction, |
|
|
unsigned int |
speed |
|
) |
| |
Turn on Point Drive on Motor Forward and the other Backward with the given speed.
- Parameters
-
direction | - left or right |
speed | - Speed between 0 and 255 |
Definition at line 87 of file Drive.cpp.
◆ stop()
Power of the Motor. Does not apply breaking.
Definition at line 110 of file Drive.cpp.
◆ decodeDirection()
String Drive::decodeDirection |
( |
Direction |
direction | ) |
|
|
private |
Decodes the Direction-Enum and returns a description.
- Parameters
-
direction | - enum Direction |
- Returns
- String - State as String
Definition at line 124 of file Drive.cpp.
◆ pAFMS
Adafruit_MotorShield Drive::pAFMS = Adafruit_MotorShield() |
|
private |
◆ pMotorRight
Adafruit_DCMotor* Drive::pMotorRight |
|
private |
Pointer to right Motor Obj.
Definition at line 97 of file Drive.h.
◆ pMotorLeft
Adafruit_DCMotor* Drive::pMotorLeft |
|
private |
Pointer to left Motor Obj.
Definition at line 98 of file Drive.h.
◆ pSpeedLeft
actual Speed of left Motor
Definition at line 99 of file Drive.h.
◆ pSpeedRight
actual Speed of right Motor
Definition at line 100 of file Drive.h.
◆ pTurnSpeedLeft
int Drive::pTurnSpeedLeft |
|
private |
◆ pTurnSpeedRight
int Drive::pTurnSpeedRight |
|
private |
◆ pWayVehicle
Actual movingdirection Forward or Backward.
Definition at line 103 of file Drive.h.
The documentation for this class was generated from the following files: