158 return (int32_t)((double)counter / 545 * 360);
Handling the Lower MCU (STM32) communication.
RESULT GetRotateState(uint8_t num, bool &isEnd)
RESULT SetDCMotorPower(uint8_t num, int16_t power)
RESULT SetDCMotorRotate(uint8_t num, int16_t maxSpeed, uint16_t degree)
RESULT GetEncoderCounter(uint8_t num, int32_t &enCounter)
RESULT SetDCMotorSpeed(uint8_t num, int16_t speed)
RESULT SetEncoderResetCounter(uint8_t num)
RESULT SetPIDParam(uint8_t num, uint8_t pidNum, float kp, float ki, float kd)
RESULT SetDCMotorSpeedRange(uint8_t num, uint16_t min, uint16_t max)
RESULT SetDCBrake(uint8_t num)
RESULT SetDCMotorDir(uint8_t num, DIR dir)
Class for controlling a DC motor with encoder functionality.
bool setReverse(bool dir)
Sets the direction of the DC motor.
bool setFixSpeedPID(float kp, float ki, float kd)
Sets the PID parameters for fixed speed control. (For SetSpeed())
bool resetCounter(void)
Resets the encoder counter to zero.
bool setBrake(bool brake)
Sets the brake mode for the DC motor.
bool setSpeed(int16_t speed)
Sets the speed of the DC motor.
bool setPower(int16_t power)
Sets the power level of the DC motor.
int32_t getCounter(void)
Gets the current encoder counter value. (Not Degree)
int32_t getDegrees(void)
Gets the current rotation in degrees based on the encoder count.
bool ChkRotateEnd(bool &isEnd)
Checks if the rotation has ended.
bool rotateFor(int16_t speed, uint16_t degree)
Rotates the DC motor for a specific degree at a given speed.
bool setRotatePID(float kp, float ki, float kd)
Sets the PID parameters for rotation control. (For rotateFor())
bool begin(void)
Initializes the DC motor settings.