error while compiling the PID_Basic.ino code exemple from the PID library

Hi all,
I dowloaded the PID library and the while trying to compile the PID_Basic.ino code that comes as an exemple with the library It shoes this error statement:

/Users/clementkostov/Documents/Arduino/libraries/Arduino-PID-Library-master/PID_v1.cpp: In constructor ‘PID::PID(double*, double*, double*, double, double, double, int)’:
/Users/clementkostov/Documents/Arduino/libraries/Arduino-PID-Library-master/PID_v1.cpp:46: error: type ‘PID’ is not a direct base of ‘PID’

// The PID_Basic.ino code is as follows
 * PID Basic Example
 * Reading analog input 0 to control analog PWM output 3

#include <PID_v1.h>

#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()
  //initialize the variables we're linked to
  Input = analogRead(PIN_INPUT);
  Setpoint = 100;

  //turn the PID on

void loop()
  Input = analogRead(PIN_INPUT);
  analogWrite(PIN_OUTPUT, Output);

I am not very familiar with C++ but I don’t understand why a code set as an example in the library folder wouldn’t compile…
thank you for your help.


Compiles fine for me for Arduino UNO, PID_v1 library 1.2.0, and Arduino IDE V1.8.2. What versions are you using?

I am using Arduino UNO, PID_v1 library 1.2.0, and Arduino IDE V1.0.6. maybe it is due to the arduino IDE version because it compiles on my desktop computer which has 1.8.4.

Sounds like an incompatibility with 1.0.6 (or your installation of 1.0.6 is faulty in some way). That version is over three years old but if you really want to use it for this project you may want to try re-installing it.