PID_v1 not computing or at least not changing output.

Hi again,

I'm making a cruise control-prototype using the PID_v1 library. I had it working previously with the standard notation:

//PID init
double Kp = 0.01;
double Ki = 0.1;
double Kd = 0;
double setpoint = 0;
double RPM_double = (double) RPM;
double serial_throttle_double = (double) serial_throttle;
PID myPID(&RPM_double, &serial_throttle_double, &setpoint, Kp, Ki, Kd, REVERSE);

but now I changed it using pointers because I need to change the setpoints for different cruise controls:

double* pSetpoint =  &init_setpoint;
double* pProces_value =  &init_proces_value;
double serial_throttle_double = 1700;
double rpm_double = 0;
PID myPID(pProces_value, &serial_throttle_double, pSetpoint, Kp_rpm, Ki_rpm, Kd_rpm, REVERSE);

now when I compute the PID the output doesn't change. I checked if the values are pointed to correctly and they seem to be ok. When I print the dereferenced value It is the correct value.

Any ideas?


Bachelorproef_modes.ino (17.2 KB)