#include <PID_v1.h>

double Setpoint;
double photocellreading;
double ledBrightness;

double kp = .1, ki = 10, kd = .012;

#define photocellPin 0
#define ledPin 5

//setup PID
PID myPID(&photocellreading, &ledBrightness, &Setpoint, kp, ki, kd, DIRECT);

void setup() {
  Serial.begin(9600);

  Setpoint = 600;
  myPID.SetMode(AUTOMATIC);
  myPID.SetTunings(kp, ki, kd);
  delay(1000);
}

void loop() {
  photocellreading = analogRead(photocellPin);
  myPID.Compute();
  analogWrite(ledPin, ledBrightness);

  Serial.println(photocellreading);
}