arduino PID control setpoint

Please read my PID control code ,why I set different paramaters of ki kp kd setpoint ,there is no change in output,?I use a function generator as an input to Arduino Due, then measure output in oscilloscope, I find the output signal change nothing when I set different paramaters of ki kp kd setpoint. Who knows the paramater of setpint means what,Voltage? If I set setpoint=5, how many is the setpoint?

_1003new.ino (4.32 KB)

 int digRead = SPDTread(inSPDT0, inSPDT1);
  if(digRead==1) controllerDirection==DIRECT;
  else if (digRead==2) controllerDirection==REVERSE;

It appears that you are trying to assign a value to controllerDirection. That is done using =, not ==.


delay() takes an integral value. A delay of 0 is useless.

The whole idea behind PID is to adjust some output to make the input match the setpoint. What is the input? Typically that would be something like a measured temperature. The output is then used to control some aspect of the process, like turning up or down a heater or cooling fan. What are you doing with the output, and how is that supposed to move the input closer to the setpoint?

Thanks for your help, but when I change my setpoint paramater, I find nothing changed in the output, for example setpoint=1 ,5,1000, all the outputs are same.

Line 29: bool inAuto = false;

your first line in the Compute() function Kicks you out because you never set it to automatic

void Compute()
  if(!inAuto) return;//?