enable and disable a code

Hello, I wanted to ask about a way to enable and disable a code, I mean. I have a code that reads an input proportional analog output through a potentiometer and illuminates proportionally led, and I have another code that reads analog input through a ldr, beating a certain threshold resistive turn on or turn off the LED, I mean will digital and proportional as the previous case. My question is, in what way I can enable or disable a second step to only one action code on the LED And being able switch the inputs?
Sorry if not understood, traduci by google.
Thank you.

Some questions.

Have you got 2 LEDs or is it just one that is to be controlled ? It seems like one from what you say, but just to be sure.
What is it that will enable/disable the actions, a switch or a button perhaps ?
Have you actually combined the 2 programs together ?

You have to decide how the two sets of behaviour will be combined.

For example, you might decide that the LED turns on at 100% brightness when the LDR input passes the threshold, and turns on at a brightness proportional to the analog input the rest of the time.

Then you need to write code to implement your chosen behaviour. For example:

if(ldrValue > ldrThreshold)
{
   setLedBrightness(255);
}
else
{
  setLedBrightness(potValue);
}