 #define DIR_PIN 12
 #define CART_RESET_PIN 21
 
-float prevSetpoint = 0; // temp - debug
+// float prevSetpoint = 0; // temp - debug
 
 // For incoming serial data
 int incomingByte = 0;


void printStatus(PIDControl &pid)
{
  String s = String("kp,ki,kd: ") + kp + ", " + ki + ", " + kd
             + String("; p,i,d: ") + pid.kp + ", " + pid.ki + ", " + pid.kd
             + String(" setpoint: ") + pid.setpoint
             + String(" output: ") + pid.output
             + String(" pwm: ") + dutyCycle;
  Serial.println(s);
}



// PID control for cart position
float kp = 2, ki = 10, kd = 0; // Initial/default PID gain coeffs
unsigned long timeStep = 20; // ms
PIDControl cartPid(kp, ki, kd, 0, timeStep);
elapsedMillis pidTimer = 0;

