     pinMode(output_lights[i], OUTPUT);
     digitalWrite(output_lights[i], LOW);
   }
-  
-  // init all outputs for gear being lodged correctly
-  for(int i=0; i<3; i++)
-  {
-    pinMode(gear_lodged[i], OUTPUT);
-    digitalWrite(gear_lodged[i], LOW);
-  }
 }
 
 // this is run continuously after setup has completed
 void loop() 
 {
+  delay(50);
   int selector_pos = getSelectorGearPosition();
-  if (selector_pos == -1)
+  Serial.println(selector_pos);
+  return;
+  if (selector_pos == -2)
   {
     sendCastleErrorMessage();
+    return;
+  }
+  else if (selector_pos == -1)
+  {
+    // we haven't made it to a new position yet, do nothing.
     return;
   }
 

}

// based on the pot value, we know which of the 7 positions the selector gear is in
// returns an int 0-6 inclusive or -1 in error cases
// if the pot value is out of range, throws an error and informs the castle operators that the puzzle is broken
// the position of the selector gear uniquely determines the position of all of the other gears
int getSelectorGearPosition() 
{
  int val = analogRead(pot);
  
  for (int i=0; i<7; i++)
  {
    if (val > pot_locs[i] && val < pot_locs[i+1])
    {
      return i;
    }
  }
  
  // else: val is below pot_locs[0] or greater than pot_locs[7]
  // puzzle is borken
  return -1;
}

// PIN NUMBERS
int output_lights[7] = {38, 39, 40, 41, 42, 43, 44};

int red_button = 30;

int pot = A0;

int photoresistors[3] = {A1, A2, A3};

// if the potentiometer is between pot_locs[2*i] and pod_locs[2*i+1], then we 
// say we are in position i.  otherwise, we are between positions.
int pot_locs[14] = {1024, 885, 825, 690, 640, 450, 390, 280, 190, 70, 50, 24, 12, 0};


// STATE OF THE WORLD
