Motor
Fork of Motor by
Motor Class Reference
Class for controlling motors trough PCA9555. More...
#include <motor.h>
Public Member Functions | |
Motor (PinName PWMpin, PCA9555 *ioExt, unsigned int dir1Pin, unsigned int dir2Pin, PinName encA, PinName encB) | |
Create an instance of the motor connected to specfied pins, and IO-expander. | |
void | setSpeed (int newSpeed) |
Set speed setpoint. | |
int | getSpeed () |
Get current speed setpoint value. | |
void | pid () |
Method that calculates appropriate PWM values for keeping motor speed close to setpoint This method shoud be called periodically (60Hz) |
Detailed Description
Class for controlling motors trough PCA9555.
Definition at line 8 of file motor.h.
Constructor & Destructor Documentation
Motor | ( | PinName | PWMpin, |
PCA9555 * | ioExt, | ||
unsigned int | dir1Pin, | ||
unsigned int | dir2Pin, | ||
PinName | encA, | ||
PinName | encB | ||
) |
Create an instance of the motor connected to specfied pins, and IO-expander.
- Parameters:
-
PWMpin Pin for PWM output *ioExt Pointer to IO-expander object dir1Pin Direction pin 1 number (on IO-expander) dir2Pin Direction pin 2 number (on IO-expander) encA Encoder pin encB Encoder pin
Member Function Documentation
void pid | ( | ) |
Generated on Thu Aug 4 2022 03:39:56 by 1.7.2