Arduino PID Library

Hey All,

This is my first post on the Fourms, but I have been playing with the Arudino for about 3 months now.

I am trying to learn PID using this library and have set up a circuit with a photoresistor and an LED. This circuit works per the AnalogReadWrite built in example (changed to output on digital pin 3 however).

I am having trouble making the PID library work at all. I have set up the serial monitor to check the Output from the library, and I do not get a response. Any help would be appreciated!

/********************************************************
 * 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,2,1);

void setup()
{
  //initialize the variables we're linked to
  Input = analogRead(0);
  Setpoint = 250;
  Serial.begin(9600);

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

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