 void setup()
 {
   setupSerial();
+  
   setupState();
   setupHelm();
   setupOps();


void updateHelm()
{
  // get new values
  pitch = readDirection(PIN_PITCH_U, PIN_PITCH_D);
  roll = readDirection(PIN_ROLL_R, PIN_ROLL_L);
  yaw = readDirection(PIN_YAW_R, PIN_YAW_L);

  // helm are always sent without enable code
  Serial.println(pitch);
  Serial.println(yaw);
  Serial.println(roll);

  // read throttle
  throttle = readThrottle(PIN_THROTTLE);
  Serial.println(throttle);
}

void updateOps()
{
  byte ops = 0;
  byte index = 0;


  for (index = 0; index < OPS; index++)

};

// this controls whether the python script closes or not, 1 == run
boolean state = 1;

// specialized control functions



//// helper functions
//

int8_t readDirection(uint8_t pinH, uint8_t pinL, int8_t adj) // get control input
{
  switch (digitalRead(pinH) ? full : (digitalRead(pinL) ? half : zero))
  {
    case full:
      if (adj++ >= RAMP_MAX)
        adj = RAMP_MAX;
      break;
      
    case zero:
      if (adj-- <= RAMP_MIN)
        adj = RAMP_MIN;
      break;

    default:
      adj = 0;
  }
  
  return (adj);
}

int16_t setDirection(int16_t current, boolean stick, int8_t adj)
{
  current += adj;

  if (!(adj || stick))
    current = 0;

  if (current > DIR_MAX)
    current = DIR_MAX;

  if (current < DIR_MIN)
    current = DIR_MIN;

  return (current);
}

uint8_t readThrottle(uint8_t pin) // get throttle input
{
  return ((uint8_t) (((float)analogRead(pin) * THOTTLE_MAX) / ANALOG_MAX));
}


