question about PID output

hello ,
What should serial print (output) show in this PID_Basic code ? because it
appears just 0.00

#include <PID_v1.h>

 

/********************************************************
 * PID Basic Example
 * Reading analog input 0 to control analog PWM output 3
 ********************************************************/
 

#define PIN_INPUT 0
#define PIN_OUTPUT 3

//Define Variables we'll be connecting to
double Setpoint, Input, Output;

//Specify the links and initial tuning parameters
double Kp=2, Ki=5, Kd=1;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);

void setup()
{
 Serial.begin(9600);
  //initialize the variables we're linked to
  Input = analogRead(PIN_INPUT);
  Setpoint = 100;

  //turn the PID on
  myPID.SetMode(AUTOMATIC);
}

void loop()
{
  Input = analogRead(PIN_INPUT);
  myPID.Compute();
  analogWrite(PIN_OUTPUT, Output);
  Serial.print(Input); Serial.print("\t");
  Serial.print(Output); Serial.print("\t");
  Serial.print(Setpoint); Serial.print("\t");
}

Why are you writing the PID output to the output pin ?

That does not sound right.

hi, I add a serial print to know if the PID works

I put a joystick in A0 and LED in D3

What is printed for Input and Setpoint? Post some example output.

Hi,I put a joystick in A0 (input) and LED in D3 (output)

My objective: is how do I know if my PID work.

What is printed for Input and Setpoint? Post some example output.

Thanks Jremington,

Thanks UKHeliBob,

I have solved my problem ,I haven't seen the output in serial monitor correctly.

I love Arduino