With this code you can run your own PID controller constructed in Arduino. The reference is set getting the signal from a potentiometer so that the system can track the desired value reading the current brightness of the LED through the photoresistor.
Further improvements and tests will come.