Limit switch coding

  if ((inputXValue < 470) && (LimitX = HIGH)) {

You are setting LimitX to HIGH instead of testing its value