 //Volatile Variables used by the interrupt handlers
 volatile int16_t adc_value=0;          //ADC value read by ADS1118
 volatile int16_t temperature_value=0;  //internal temp of ADS1118
+double kP=2, kI=0, kD=0;
 
 //Global Objects
 #define OLED_RESET 4
 Adafruit_SSD1306 display(OLED_RESET);  //TODO: look into this reset pin. The LCD i'm using does not have a reset pin, just PWR,GND,SDA,SCL
 
-DellPSU dell(1);   //specify the desired Arduino pin number
+DellPSU dell(DELL_PSU);   //specify the desired Arduino pin number
+double Setpoint, Input, Output;
+//Specify the links and initial tuning parameters
+PID myPID(&Input, &Output, &Setpoint,kP,kI,kD, DIRECT); //TODO: map this properly
 
 
 //----------------Setup-------------------------

  */
  //setup PWM and interrupts. These use the 16 bit timer1
  #define PWM_PERIOD_US 20000 //20000us = 20ms = 50Hz PWM frequency. We have to go slow enough to allow time for sampling the ADC during the PWM off time
  #define PWM_PERIOD_MS (PWM_PERIOD_US/1000)  
  Timer1.initialize(PWM_PERIOD_US);  
  Timer1.pwm(LPINB, 1023-61); //we need 1.2 ms to sample the ADC. assuming 860 SPS setting
  Timer1.pwm(LPINA, 2); //100% = 1023
  delay(PWM_PERIOD_MS); //make sure both PWM's have run at least one full period before enabling interrupts 


#include <DigitalIO.h>          //https://github.com/greiman/DigitalIO
#include <dell_psu.h>           //https://github.com/timothyjager/DellPSU
#include <EEWrap.h>             //https://github.com/Chris--A/EEWrap
#include <PID_v1.h>             //https://github.com/br3ttb/Arduino-PID-Library/

#include "ads1118.h"

