[Solved] Will not compile

Hi

I am trying to compile my code however it will not compile with the following in the sketch

Braces have been moved so that Set_Servos is complete.

I have copy and pasted the problem area into a new sketch. I have not defined anything I know I am not worried about those errors. This code still hangs in the same location as the original. (If you would like the full code I can upload).

I have commented out the problem area so that it compiles as is however if I move the braces and /* down past the next if statement it will hang.

Am I missing something simple? I cant see anything wrong with the above.

Any help would be appreciated.

Not_Compiling.ino (9.66 KB)

Post COMPILABLE code within code tags!

Here is the part that will comiple.

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

//For each servo set all Values
void SetServos(){
 
  ReadEEPROM();     //Read the current EEPROM

  if(ServoNo == 2){                             //Wing Fold Left Servo
    UpperLimit = WingFoldLeftUpperTrimValE;    //Current EEPROM store location of Upper limit
    LowerLimit = WingFoldLeftLowerTrimValE;    //Current EEPROM store location of Lower limit 
    RevVal = WingFoldLeftRevValE;              //Current EEPROM store location of Rev value 
    Speed = WingFoldSpeedValE;                 //Current EEPROM store location of Speed 
    ServoNo = 9;                               //ServoNo for controler
    Controller = 40;                           //Servo controlelr number
  } 
  
  if(ServoNo == 3){                             //Wing Fold Right Servo
    UpperLimit = WingFoldRightUpperTrimValE;   //Current EEPROM store location of Upper limit
    LowerLimit = WingFoldRightLowerTrimValE;   //Current EEPROM store location of Lower limit
    RevVal = WingFoldRightRevValE;             //Current EEPROM store location of Rev value 
    Speed = WingFoldSpeedValE;                 //Current EEPROM store location of Speed 
    ServoNo = 10;                              //ServoNo for controler
    Controller = 40;                           //Servo controlelr number
  } 

  if(ServoNo == 4){                             //Wing Lock Servo
    UpperLimit = WingLockUpperTrimValE;        //Current EEPROM store location of Upper
    LowerLimit = WingLockLowerTrimValE;        //Current EEPROM store location of Lower
    RevVal = WingFoldLockRevValE;              //Current EEPROM store location of Rev vlaue
    Speed = WingFoldLockSpeedValE;             //Current EEPROM store location of Speed
    ServoNo = 11;                              //ServoNo for controler
    Controller = 40;                           //Servo controlelr number
    Times = Wing_LockUnlock_Delay_Time_ValE    //Current EEPROM store location of Timed values
  } 

  if(ServoNo == 5){                             //Right Gear Servo
    UpperLimit = RightGearUpperTrimValE;       //Current EEPROM store location of Upper limit 
    LowerLimit = RightGearLowerTrimValE;       //Current EEPROM store location of Lower limit 
    RevVal = RightGearRevValE;                 //Current EEPROM store location of Rev value
    Speed = RightGearSpeedValE;                //Current EEPROM store location of Speed 
    ServoNo = 8;                               //ServoNo for controler
    Controller = 42;                           //Servo controlelr number
  } 

  if(ServoNo == 6){                             //Left Gear Servo
    UpperLimit = LeftGearUpperTrimValE;        //Current EEPROM store location of Upper limit 
    LowerLimit = LeftGearLowerTrimValE;        //Current EEPROM store location of Lower limit 
    RevVal = LeftGearRevValE;                  //Current EEPROM store location of Rev value 
    Speed = LeftGearSpeedValE;                 //Current EEPROM store location of Speed 
    ServoNo = 7;                               //ServoNo for controler
    Controller = 42;                           //Servo controlelr number
  } 
}

And straight after that is this code that does not comiple. All in the same format so thats why I dont understand what is happening.

Sorry had to split it as it is too big for 1 comment.

/*
Hangs from this point on

  if(ServoNo == 7){                             //Wing Gear Doors Servo
    UpperLimit = WingGearDoorsUpperTrimValE;   //Current EEPROM store location of Upper limit 
    LowerLimit = WingGearDoorsLowerTrimValE;   //Current EEPROM store location of Lower limit 
    RevVal = WingGearDoorsRevValE;             //Current EEPROM store location of Rev value 
    Speed = WingGearDoorsSpeedValE;            //Current EEPROM store location of Speed 
    ServoNo = 5;                               //ServoNo for controler
    Controller = 42;                           //Servo controlelr number
  } 

  if(ServoNo == 8){                             //Engine Starter Servo
    UpperLimit = EngineStartUpperTrimValE;     //Current EEPROM store location of Upper limit
    LowerLimit = EngineStartLowerTrimValE;     //Current EEPROM store location of Lower limit 
    RevVal = EngineStartRevValE;               //Current EEPROM store location of Rev value
    Speed = EngineStartSpeedValE;              //Current EEPROM store location of Speed 
    ServoNo = 0;                               //ServoNo for controler
    Controller = 42;                           //Servo controlelr number
    Times = EngineStart_TimeValE;              //Current EEPROM store location of Starter engaged time
  } 
  
  if(ServoNo == 9){                             //Tail Gear Servo
    UpperLimit = TailGearUpperTrimValE;        //Current EEPROM store location of Upper limit 
    LowerLimit = TailGearLowerTrimValE;        //Current EEPROM store location of Lower limit 
    RevVal = TailGearRevValE;                  //Current EEPROM store location of Rev value 
    Speed = TailGearSpeedValE;                 //Current EEPROM store location of Speed 
    ServoNo = 6;                               //ServoNo for controler
    Controller = 42;                           //Servo controlelr number
  }

  if(ServoNo == 10){                            //Tail Door Servo
    UpperLimit = TailGearDoorUpperTrimValE;    //Current EEPROM store location of Upper limit 
    LowerLimit = TailGearDoorLowerTrimValE;    //Current EEPROM store location of Lower limit
    RevVal = TailGearDoorRevValE;              //Current EEPROM store location of Rev value 
    Speed = TailGearDoorSpeedValE;             //Current EEPROM store location of Speed 
    ServoNo = 3;                               //ServoNo for controler
    Controller = 42;                           //Servo controlelr number
  }

  if(ServoNo == 11){                            //Brakes Servo
    UpperLimit = BrakeUpperTrimValE;           //Current EEPROM store location of Upper limit 
    LowerLimit = BrakeLowerTrimValE;           //Current EEPROM store location of Lower limit 
    RevVal = BrakeRevValE;                     //Current EEPROM store location of Rev value 
    Speed = BrakeSpeedValE;                    //Current EEPROM store location of Speed 
    ServoNo = 2;                               //ServoNo for controler
    Controller = 42;                           //Servo controlelr number
  }
  
  if(ServoNo == 12){                            //Cowl Flaps Servo
    UpperLimit = CowlUpperTrimValE;            //Current EEPROM store location of Upper limit 
    LowerLimit = CowlLowerTrimValE;            //Current EEPROM store location of Lower limit 
    RevVal = CowlRevValE;                      //Current EEPROM store location of Rev value 
    Speed = CowlSpeedValE;                     //Current EEPROM store location of Speed 
    ServoNo = 2;                               //ServoNo for controler
    Controller = 40;                           //Servo controlelr number
  }
  
  if(ServoNo == 13){                            //Oil Cooler Flaps Servo
    UpperLimit = OilCoolerUpperTrimValE;       //Current EEPROM store location of Upper limit 
    LowerLimit = OilCoolerLowerTrimValE;       //Current EEPROM store location of Lower limit 
    RevVal = OilCoolerRevValE;                 //Current EEPROM store location of Rev value 
    Speed = OilCoolerSpeedValE;                //Current EEPROM store location of Speed 
    ServoNo = 1;                               //ServoNo for controler
    Controller = 40;                           //Servo controlelr number
  }

  if(ServoNo == 14){                              //Tail Wheel Steering Servo
    UpperLimit = TailWheelSteeringUpperTrimValE; //Current EEPROM store location of Upper limit 
    LowerLimit = TailWheelSteeringLowerTrimValE; //Current EEPROM store location of Lower limit 
    RevVal = TailWheelSteeringRevValE;           //Current EEPROM store location of Rev value 
    Speed = TailWheelSteeringSpeedValE;          //Current EEPROM store location of Speed 
    ServoNo = 4;                                 //ServoNo for controler
    Controller = 42;                             //Servo controlelr number
  }
  
  if(ServoNo == 15){                              //Choke Servo
    UpperLimit = ChokeUpperTrimValE;             //Current EEPROM store location of Upper limit 
    LowerLimit = ChokeLowerTrimValE;             //Current EEPROM store location of Lower limit 
    RevVal = ChokeRevValE;                       //Current EEPROM store location of Rev value 
    Speed = ChokeSpeedValE;                      //Current EEPROM store location of Speed 
    ServoNo = 6;                                 //ServoNo for controler
    Controller = 40;                             //Servo controlelr number
  }

  if(ServoNo == 20){                              //Landing Gear General
    Enabled = LandingGearStaggerEnableValE;      //Current EEPROM store location of landing Gear staggrer Enable/disable
    Stagger = LandingGearStaggerValE;            //Current EEPROM store location of Stagger Value
    Times = DoorClose_GearExtend_Delay_ValE;     //Current EEPROM store location of Timed values
  }
  
  if(ServoNo == 21){                              //Wing Fold General
    Enabled = WingFoldStaggerEnableValE;          //Current EEPROM store location of landing Gear staggrer Enable/disable
    Stagger = WingFoldStaggerDelayTimeValE;       //Current EEPROM store location of Stagger Value
    Times = WingFold_Count_Timer_ValE;            //Current EEPROM store location of Timed values
  }

  if(Cal_Area == 1)EEPROM_Read_Location = UpperLimit;
  if(Cal_Area == 2)EEPROM_Read_Location = LowerLimit;
  if(Cal_Area == 3)EEPROM_Read_Location = RevVal;
  if(Cal_Area == 4)EEPROM_Read_Location = SpeedVal;
  if(Cal_Area == 5)EEPROM_Read_Location = Enabled;
  if(Cal_Area == 6)EEPROM_Read_Location = Stagger;
  if(Cal_Area == 7)EEPROM_Read_Location = Times;
 
*/

Have you even tried it? Of course it doesn't compile! The function ReadEEPROM() is not defined in this code. Let alone the rest of the variables....

If you can reproduce the error with a COMPILABLE piece of your code, fine post that. But if you can't, post the whole code!

/* starts a multi line comment so where are you ending the comment?

Mark

septillion - Yes of coarse I have tried it.
I did say I don't care about the errors it throws and ReadEEPROM() not being there does not matter it simply throws another error " 'ReadEEPROM' was not declared in this scope ". The problem isn't that it throws errors, in the full code these errors do not exist. The problem is that it hangs when the second part of the code is uncommented. The whole IDE freezes. Sorry the heading may be a bit misleading however I thought I explained it ok in the comments.

Mark (holmes4) - It is ended the very last line of the second part of the code. As that part of the code is the problem area. And as such is commented out so that the IDE does not freeze when trying to Verify/Compile.

Yeay, but that's not how the forum works :wink: See the sticky "Read this before posting a programming question ..."

What isnt how the forum works? You want the full code?

Click the link, read the text....

I did!!!!!! and I have done before. Your post is very ambiguous. Just say what you want and stop being a ....... about it.

Code isn't hanging anymore neways. In future don't worry bout replying to my topics.
If you cant be helpful or at least say what you want don't worry about doing anything.

If the full code is what you where after it is in 26 files and is 142KB I was trying to not wast peoples time sifting through code that works when all I had was a problem with the code posted.

If it is about the heading being a bit misleading it still relates. Freezing when compiling still is not compiling.

Sorry for being a ... But the forum rules are there for a reason :wink: We want to replicate THE error and that can only be done with the whole code. And if you like, the whole code may be a snippet as long as it compiles/give the same error. Not some random other error because you just copied a part of the code.

And as for the not replying anymore I can't guarantee. I'm simply not going to remember your username....