Arduino PID Library

[his example 1]


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

#include <PID_Beta6.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);

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

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

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


[Your non-working example]
include <WProgram.h>
include<PID_Beta6.h>
class foo{
public:
PID myPID;
}


I guess I don't understand your critique - your example stuff doesn't look like his example stuff????

Can you 'splain the problem in words of at most two syllables? :slight_smile:

Brian W