 int backBentBShoulderTol = -1;
 int backBentBUnderTol = -1;
 
+// --------------------------------------------
+
+int * computeAvg(){
+  int i = 100;
+  int backSum = 0;
+  int rShoulderSum = 0;
+  int lShoulderSum = 0;
+  int rUnderarmSum = 0;
+  int lUnderarmSum = 0;
+  
+  while (i > 0){
+    if (i % 20 == 0) {
+      Serial.println(i / 20);
+    }
+    
+    backSum += analogRead(backPin);
+    rShoulderSum += analogRead(shoulderPin);
+    rUnderarmSum += analogRead(underarmPin);
+    
+    i--;
+    delay(50);
+  }
+  
+  int ret[6] = {backSum/100, rShoulderSum/100, rUnderarmSum/100, backSum/100, lShoulderSum/100, lUnderarmSum/100};
+  return ret;
+}
 
 void setVariables(){
+  
+  //setup
+  int *avgs;
   
   // -------- Arms at side --------
   Serial.println("Put your arms at your side \nPress button when ready");

  //wait for button press
  while(digitalRead(buttonPin) != 1){}
  
  backBentFBackVal = -1;
  backBentFShoulderVal = -1;
  backBentFUnderVal = -1;
  
  delay(250);
  

  //wait for button press
  while(digitalRead(buttonPin) != 1){}
  
  avgs = computeAvg();
  
  armFR45BackVal = avgs[0];
  armFR45ShoulderVal = avgs[1];
  armFR45UnderVal = avgs[2];
  
  armFL45BackVal = avgs[3];
  armFL45ShoulderVal = avgs[4];
  armFL45UnderVal = avgs[5];
  
  delay(250);
  
