PID motor controll for the biorobotics project.
Dependents: PID_example Motor_calibration Demo_mode Demo_mode ... more
Diff: motor.h
- Revision:
- 2:b30a467e90d3
- Parent:
- 0:009e84d7af32
- Child:
- 4:5353c5d0d2ed
--- a/motor.h Fri Oct 19 11:01:52 2018 +0000 +++ b/motor.h Mon Oct 29 14:15:57 2018 +0000 @@ -30,11 +30,14 @@ // For debugging purposes; Serial* pc; + bool serial_debugging; int printcount; float pid_period; public: // Initializes the motor with the two driver pins, and the two encoder pins. Motor(PinName pwm_pin, PinName dir_pin, PinName encoder_a, PinName encoder_b, Serial* pc); + // Initialize the motor without serial output. + Motor(PinName pwm_pin, PinName dir_pin, PinName encoder_a, PinName encoder_b); // Set the angle the motor needs to rotate to. In radians. void set_target_angle(double angle); void set_pid_k_values(double k_p, double k_i, double k_d);