Error with PID Basic Example

I have downloaded and imported the Arduino PID Library (PID.v1.h) by Sketch>Import Library>Add Library, then selecting the unzipped file. It automatically zips and imports the library like this in program (#include <PID_v1.h>). That means no problem with library.

I tried with PID Basic Example.

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

#include <PID_v1.h>

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

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

void setup()
{
  //initialize the variables we're linked to
  Input = analogRead(0);
  Setpoint = 100;

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

void loop()
{
  Input = analogRead(0);
  myPID.Compute();
  analogWrite(3,Output);
}

But when I want to compile by clicking on (Verify), it says the following error.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
C:\Users\khondoke\Documents\Arduino\libraries\PID_v1\PID_v1.cpp: In constructor 'PID::PID(double*, double*, double*, double, double, double, int)':
C:\Users\khondoke\Documents\Arduino\libraries\PID_v1\PID_v1.cpp:26: error: 'millis' was not declared in this scope
C:\Users\khondoke\Documents\Arduino\libraries\PID_v1\PID_v1.cpp: In member function 'void PID::Compute()':
C:\Users\khondoke\Documents\Arduino\libraries\PID_v1\PID_v1.cpp:43: error: 'millis' was not declared in this scope

I don’t know the problem. Could you please anyone help me out? Thank you!

There is something wrong in your computer. I download the library and install it and it worked fine.

luisilva:
There is something wrong in your computer. I download the library and install it and it worked fine.

I tried in two desktop and one laptop, it doesn’t work. :frowning:

Thanks anyway…any suggestion.

Where did you get your version of the library from? (Directed to both @luisilva and @khondoke)

In my case I Google-it. I copy “PID Library (PID.v1.h)” from the post of khondoke and past to Google. The first result was this. I download it from the first link.

Well that worked for me also.

I don’t know, what’s wrong with me. I still can’t do this. It says the same error message.

The library downloading page offers many versions. In attached screen-shot, there are three ways to download the latest version. which way did you both (luisilva and ChilliTronix) use? Thanks.

NB. Extremely sorry for late reply.

Untitled.jpg