|
PetCare
|
Controller for a stepper motor that supports basic directional commands. More...

Public Member Functions | |
| MotorController (int pin1, int pin2, int pin3, int pin4) | |
| Constructor for MotorController. | |
| ~MotorController () | |
| Destructor for MotorController. | |
| void | rotateForward (int steps) |
| Rotate the motor forward by a specific number of steps. | |
| void | rotateBackward (int steps) |
| Rotate the motor backward by a specific number of steps. | |
| void | stop () |
| Stop the motor immediately. | |
| void | reset () |
| Reset the direction flags of the motor to false. | |
| bool | hasRotatedForward () const |
| Check if the motor has rotated forward. | |
| bool | hasRotatedBackward () const |
| Check if the motor has rotated backward. | |
Controller for a stepper motor that supports basic directional commands.
This class provides functionality to control a stepper motor with forward, backward, and stop commands. It directly interacts with the hardware using GPIO operations.
| MotorController::MotorController | ( | int | pin1, |
| int | pin2, | ||
| int | pin3, | ||
| int | pin4 ) |
Constructor for MotorController.
| pin1 | GPIO pin number connected to the first motor pin. |
| pin2 | GPIO pin number connected to the second motor pin. |
| pin3 | GPIO pin number connected to the third motor pin. |
| pin4 | GPIO pin number connected to the fourth motor pin. |
| bool MotorController::hasRotatedBackward | ( | ) | const |
Check if the motor has rotated backward.
| bool MotorController::hasRotatedForward | ( | ) | const |
Check if the motor has rotated forward.
| void MotorController::rotateBackward | ( | int | steps | ) |
Rotate the motor backward by a specific number of steps.
| steps | Number of steps to rotate backward. |
| void MotorController::rotateForward | ( | int | steps | ) |
Rotate the motor forward by a specific number of steps.
| steps | Number of steps to rotate forward. |