Three LEDs control by one momentary switch

Three LEDs control by one momentary switch.
The Spec:
1/ Hold the switch Red LED on, other two LEDs Green & Blue off.
2/ Click the switch toggles LEDs Green & Blue on, LED Red off.

Below two Sketches work fine! One sketch toggles LEDs Green & Blue light by momentary short click, other sketch lights up LED Red, other LED off by long hold; Short click LED Red off, other LED on .

Third one was combined two sketches. It does meet Spec 1/, but does not toggle LEDs Green & Blue. Can someone help to fix so both specs are met?

Thank you for your attention, Your help is greatly appreciated!!

***************************************************************************************
#1

// Three leds, one momentary switch
// Two Leds are toggled on by click, third one off.
// Third led on by hold, other two leds off. 


float pressLength = 0;

int optionOne = 100;
int optionTwo = 2000; 


int buttonPin = 2;
int ledPin_Option_1 = 13;
int ledPin_Option_2 = 12;
int ledPin_Option_3 = 11; // New add

int val;                 // New add
int val2;                // New add
int buttonState;         // New add 
int Mode = 0;            // New add



void setup(){
 pinMode(buttonPin, INPUT_PULLUP);     
 pinMode(ledPin_Option_1, HIGH); 
 pinMode(ledPin_Option_2, HIGH);
 pinMode(ledPin_Option_3, HIGH);  // New add
 buttonState = digitalRead(buttonPin);  // New add
 digitalWrite(ledPin_Option_2, HIGH);

 Serial.begin(9600);                                     
} 

void loop() {

 while (digitalRead(buttonPin) == LOW ){ 
   delay(100);  
   pressLength = pressLength + 100;   
   Serial.print("ms = ");
   Serial.println(pressLength);
 }
 
 if (pressLength >= optionTwo){
   digitalWrite(ledPin_Option_1, LOW); 
   digitalWrite(ledPin_Option_2, HIGH);     
 } 

 else if(pressLength >= optionOne){
    digitalWrite(ledPin_Option_2, LOW);
     val = digitalRead(buttonPin);      // read input value and store it in val
     delay(10);                         // 10 milliseconds is a good amount of time
     val2 = digitalRead(buttonPin);     // read the input again to check for bounces
     if (val == val2) {                 // make sure we got 2 consistant readings!
       if (val != buttonState) {          // the button state has changed!
         if (val == LOW) {                // check if the button is pressed
               if (Mode == 0) {         
                Mode = 1;               
           } else {
               if (Mode == 1) {       
               Mode = 0;           
           } 
         }
        }
       }
       buttonState = val;                 // save the new state in our variable
     }

     // Now do whatever the lightMode indicates
     if (Mode == 0) { // all-off
       digitalWrite(ledPin_Option_1, HIGH);
       digitalWrite(ledPin_Option_3, LOW);
     }

      if (Mode == 1) {
       digitalWrite(ledPin_Option_1, LOW);
       digitalWrite(ledPin_Option_3, HIGH);
     }

    
 }
 pressLength = 0;


}


***************************************************************************************

#2

// Two leds light toggle by momentary switch click. 
   
   int buttonPin = 2;              // switch is connected to pin 2
   int ledPin_Option_1 = 13;
   int ledPin_Option_3 = 11;
  

   int val;                        // variable for reading the pin status
   int val2;                       // variable for reading the delayed status
   int buttonState;                // variable to hold the button state
   int Mode = 0;              // What mode is the light in?

   void setup() {
     pinMode(buttonPin, INPUT_PULLUP);    // Set the switch pin as input
     pinMode(ledPin_Option_1, OUTPUT);
     pinMode(ledPin_Option_3, OUTPUT);
   
     buttonState = digitalRead(buttonPin);   // read the initial state
   }

   void loop(){
     val = digitalRead(buttonPin);      // read input value and store it in val
     delay(10);                         // 10 milliseconds is a good amount of time
     val2 = digitalRead(buttonPin);     // read the input again to check for bounces
     if (val == val2) {                 // make sure we got 2 consistant readings!
       if (val != buttonState) {          // the button state has changed!
         if (val == LOW) {                // check if the button is pressed
           if (Mode == 0) {         
             Mode = 1;               
           } else {
           if (Mode == 1) {       
               Mode = 0;  
           }
         }
        }
       }
       buttonState = val;                 // save the new state in our variable
     }

     // Now do whatever the lightMode indicates
     if (Mode == 0) { // all-off
       digitalWrite(ledPin_Option_1, LOW);
       digitalWrite(ledPin_Option_3, HIGH);
          
       }

     if (Mode == 1) {
       digitalWrite(ledPin_Option_1, HIGH);
       digitalWrite(ledPin_Option_3, LOW);
     
     }
    
     }


***************************************************************************************

#3

/ Two leds light on/off toggle. One by click, other by hold.

float pressLength_milliSeconds = 0;

int optionOne_milliSeconds = 100;
int optionTwo_milliSeconds = 2000; 


int buttonPin = 2;
int ledPin_Option_1 = 13;
int ledPin_Option_2 = 12;


void setup(){
 pinMode(buttonPin, INPUT_PULLUP);     
 pinMode(ledPin_Option_1, HIGH); 
 pinMode(ledPin_Option_2, HIGH);

 Serial.begin(9600);                                     
} 

void loop() {

 while (digitalRead(buttonPin) == LOW ){ 
   delay(100);  
   pressLength_milliSeconds = pressLength_milliSeconds + 100;   
   Serial.print("ms = ");
   Serial.println(pressLength_milliSeconds);
 }
 
 if (pressLength_milliSeconds >= optionTwo_milliSeconds){
   digitalWrite(ledPin_Option_1, LOW); 
   digitalWrite(ledPin_Option_2, HIGH);     
 } 

 else if(pressLength_milliSeconds >= optionOne_milliSeconds){
    digitalWrite(ledPin_Option_1, HIGH);
    digitalWrite(ledPin_Option_2, LOW);   
 }

 pressLength_milliSeconds = 0;

}

Welcome to the Forum. Please read these two posts:

How to use this forum - please read.
and
Read this before posting a programming question ...
You may also find useful information that would answer your question here:
Useful links - check here for reference posts / tutorials

You have posted code without using code tags. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click. Also, if you don't do it, some of the character sequences in the code can be misinterpred by the forum code as italics or funny emoticons.
If you have already posted without using code tags, open your message and select "modify" from the pull down menu labelled, "More", at the lower left corner of the message. Highlight your code by selecting it (it turns blue), and then click on the "</>" icon at the upper left hand corner. Click on the "Save" button. Code tags can also be inserted manually in the forum text using the code and /code metatags.

Unless the sketch is too large, it's better if you post your code, rather than attach it. When it's attached, we have to download it, create a folder then open your code in our IDE. And afterwards, the folder remains unless we navigate to the "Temp" folder and manually remove it. It's much easier to just view the code in your post.

I don't see where you allowed for switch contact bounce.

Paul

try to remember the state when the button is pressed, like

[code]

val =digitalRead(buttonPin);

if(val==HIGH && old_val==LOW)
{
  state=state+1;
delay(10);

}

old_val=val;

if(state==1)
{
  digitalWrite(pinLed,HIGH);
}

[/code]

Two sketches #2 & #3 work fine.
Combined these two code to the sketch#3, it is missing the functions as #2
Thank you again