hello guys;
i am trying to use pid controller code , so i had simple code from arduino library.
the error was PID myPID(&Input, &Output, &Setpoint,2,5,1, DIRECT);
and the compiler wrote 'PID' dose not name a type ,
thanks
Did you include the PID-class definition?
#include<...>
Please add the code next time, otherwise it is more guessing than helping
herr kai;
Das ist the code
/********************************************************
- 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);
}
Danke :~
After downloading the PID_v1 library from the playground, and installing it in the correct place, I compiled your code:
Binary sketch size: 4,240 bytes (of a 32,256 byte maximum)
So, the problem is on your end. Either with not downloading the library, not installing it in the correct place/way, or not restarting the IDE.