Library version for DC_Stepper_Controller_Lib with PWM speed control

Dependencies:   mbed QEI PID

Dependents:   DR-ArmServoTest Auto_DC_pick_class MBed_TR1 ros_button_2021

DC_Motor_Controller.h

Committer:
stivending
Date:
2021-05-25
Revision:
10:fe56f6800a72
Parent:
9:49b59b308767
Child:
13:675456f1f401

File content as of revision 10:fe56f6800a72:

#include "mbed.h"
#include "QEI.h"
#include <cmath>

#ifndef DC_MOTOR_CONTROLLER_H
#define DC_MOTOR_CONTROLLER_H

class DC_Motor_Controller {

    private:
        PwmOut out1, out2; 
        QEI dc_motor;
        void goto_pulse(int tar_pulse, float speed = 1);
    public:
        DC_Motor_Controller(PinName out_M1, PinName out_M2, PinName in_A, PinName in_B, int PPR);        
        void goto_angle(int angle, float speed = 1);
        void reset();
        void move_angle(int angle, float speed = 1);
        void set_out(float a, float b);
        int get_pulse();
};
#endif