 // Linear encoder
 #define LINEAR_RESOLUTION 0.005
 #define LINEAR_USED_RANGE 0.05
+#define PI 3.1415
 void computeFeedback()
 {
   
   // Feedbacks are normalized between -1 and 1
   
-  // Potentiomete angle
-  float rawAngle_deg = analogRead(POT_PIN)/1024.0*POT_RANGE_DEG;
+  // Potentiometer angle
+  float rawAngle_deg = analogRead(POT_PIN)/1023.0*POT_RANGE_DEG;
   Input1 = (rawAngle_deg - NEUTRAL_ANGLE_DEG)/POT_USED_RANGE_DEG;
   
   // Linear encoder position
   Input2 = halfSteps*LINEAR_RESOLUTION/2/LINEAR_USED_RANGE;
-  // Correct for lever arm (potentiometer not on axis)
-  Input2+= (rawAngle_deg - NEUTRAL_ANGLE_DEG)* POT_OFFSET*3.14/180;
+  // Correction for lever arm (potentiometer not on axis)
+  Input2+= (rawAngle_deg - NEUTRAL_ANGLE_DEG)* POT_OFFSET*PI/180;
   
   // Line tension
   Input3 = analogRead(LINE_TENSION_PIN)/512 - 1;

// Hardware specific parameters
// Potentiometer
#define POT_RANGE_DEG      300 // 300 is the value for standard potentiometer
#define POT_USED_RANGE_DEG  60 // To 
#define POT_OFFSET        0.05 // Distance from rotation axis to lever arm
#define NEUTRAL_ANGLE_DEG  225
// Linear encoder
#define LINEAR_RESOLUTION 0.005
#define LINEAR_USED_RANGE 0.05

void setup()
{

  // Turn the PID on
  myPID1.SetMode(MANUAL);
  myPID2.SetMode(MANUAL);
  // Saturate the output to the maximum range (values are normalized between -1 and 1)
  myPID1.SetOutputLimits(-1, 1);
  myPID2.SetOutputLimits(-1, 1);
  
  // Prepare interrupts for the linear encoder
  pinMode(A_PIN, INPUT);
  digitalWrite(A_PIN, HIGH);
  attachInterrupt(0, int0, CHANGE);

  pinMode(B_PIN, INPUT);
  digitalWrite(B_PIN, HIGH);
  attachInterrupt(1, int1, CHANGE);
  
  // Pin used to get absolute position
  pinMode(RESET_PIN, INPUT);
