Hi all,
I am attempting to make a Arduino based PID controller for controlling temperature. I am doing it in stages, and so far have used a thermocouple shield from McLaughlin Engineering to display a temp on the Arduino serial window, then I connected to a LCD to display the temps on the LCD.
So far, so good!
Now I am trying to use the PID library here -Arduino Playground - PIDLibraryRelayOutputExample.
I have extracted the PID library to my libraries folder in the Arduino IDE.
To start with I just copied & pasted the basic PID program & attempted to compile it, before I start making any changes.
I am getting the error "PID does not name a type" and the line
PID myPID(&Input, &Output, &Setpoint,2,5,1, DIRECT);
is highlighted.
I tried defining (at the top of the script) PID as unsigned long, char & byte (I really don't know what I am doing!), so far no joy.
Can anyone advise me as to how to fix this problem?
/********************************************************
* 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);
}