beginner needs help

HI

Thanks to all for the earlier info

Based on what was said and the links provided I have managed to get 1 button to control 1 servo, 2 LED's and 2 relays, on a separate relay board
Please see below sketch I have written, based on the help from this site, any comments appreciated as this is my first attempt in this field and I feel sure there will be a better way to do what I want

/*
 To control the stop position of 1 servo at both ends of the sweep, 
 Set 2 relays either on or off based on the servo position
 Set red/Green LED's to display path of the Point/Switch
 Using 1 normally open push switch - non latching
 
 The circuit:
 * LED's attached from pins 14 & 15 to ground through 220 Ohm resistors
 * pushbutton attached to pin 5 from +5V
 * 20K resistor attached to pin 5 from ground
 * Servo signal from pin 4
 
 
 created 2014
 by Notlob
 
 Based on the debounce button & servo sketches
 links to be added from the example page of arduino website
 
 */
 
 
#include <Servo.h>  // Comes with Arduino IDE 

// constants won't change. They're used here to 
// set pin numbers:
#define Servo1PIN  4  

const int buttonPin = 5;     // the number of the pushbutton pin
const int ledPin =  13;      // left this in sketch to verify the sketch works if i had wired board incorrectly
const int servopath_pin_ST = 14;    // the straight LED pin
const int servopath_pin_DV = 15;    // the diverge LED pin

// variables that will change:
int ledState = LOW;          // the current state of the output pin for pin 13 on the board
long lastDebounceTime = 0;
long debounceDelay = 50;
int buttonState = 0;         // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin
int servo_1_lastpos = 0;

// define start and end positions for each servo 
// might not be needed for all servos as some could use the same values
#define Servo1MIN  74 // Don't go to end of servo travel
#define Servo1MAX  101 // which may be 0 to 180.


// added 2 servos each will turn the posite way when button pressed
Servo myservo1;  // create servo objects to control a servos

int posservo_1 = 0;    // variable to store the servo position 


void setup() {   /****** SETUP: RUNS ONCE ******/
  // start serial port at 9600 bps and wait for port to open:
  Serial.begin(9600);
 
  // initialize the LED pins as an output:
  pinMode(ledPin, OUTPUT);
  pinMode(servopath_pin_ST, OUTPUT);
  pinMode(servopath_pin_DV, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);    

  // attaches the servo on pin 4 to the servo objects 
  myservo1.attach(Servo1PIN);  
 
  // move servo 1 to the default start position
    digitalWrite(servopath_pin_ST ,LOW);     // pin 14 - off - turn off led and set relay 8 to non-conduct
    digitalWrite(servopath_pin_DV ,LOW);     // pin 15 - off - turn off led and set relay 7 to non-conduct
   
   for(posservo_1 = Servo1MAX; posservo_1 > Servo1MIN; posservo_1 -= 1)  // goes from 0 degrees to 180 degrees 
          {                                  // in steps of 1 degree 
            myservo1.write(posservo_1);      // tell servo to go to position in variable 'posservo_1' 
            delay(50);                       // waits 50ms for the servo to reach the position 
          }
  servo_1_lastpos = Servo1MIN;

  digitalWrite(servopath_pin_DV ,HIGH);        // pin 15 - on - light green led and set relay 8 to conduct  

}//--(end setup )---  

  
void loop(){
  // read the state of the pushbutton value:
 int reading = digitalRead(buttonPin);
 if (reading != lastButtonState) {
    // reset the debouncing timer
    lastDebounceTime = millis();
  }
   if ((millis() - lastDebounceTime) > debounceDelay) {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:
    // if the button state has changed:
    if (reading != buttonState) {
      buttonState = reading;
      // only toggle the LED if the new button state is HIGH
      if (buttonState == HIGH) {
         Serial.print("button changed");
        ledState = !ledState;
        // we can now use the ledstate as the test for changing the points
      }
}
}
 digitalWrite(ledPin, ledState);  //set LED on Board to = ledstate - high or low

lastButtonState = reading;

if(ledState == HIGH ){                           // new position - set point for straight on
      if (servo_1_lastpos < Servo1MAX) {         // if point not set for straight on then
        digitalWrite(servopath_pin_ST ,LOW);     // pin 14 - turn off led and turn of frog power set relay 8 to non-conduct 
        digitalWrite(servopath_pin_DV ,LOW);     // pin 15 - turn off led and turn of frog power set relay 7 to non-conduct
        //digitalWrite(ledPin, ledState);
         for(posservo_1 = Servo1MIN; posservo_1 < Servo1MAX; posservo_1 += 1)  // goes from 0 degrees to 180 degrees 
          {                                      // in steps of 1 degree 
            myservo1.write(posservo_1);          // tell servo to go to position in variable 'posservo_1' 
            delay(50);                           // waits 50ms for the servo to reach the position 
          }
        Serial.print(" gone to ");
        Serial.print(Servo1MAX);
        Serial.println(" degrees ");
        Serial.println(" Green Light Lit, Points straight on, Relay 8 set for frog");
        servo_1_lastpos = Servo1MAX;     
        digitalWrite(servopath_pin_ST ,HIGH);   //set green led on and turn on frog power set relay 8 to conduct     
      }    
}      
else 
{                                              // new position - set point for diverge
     if(servo_1_lastpos > Servo1MIN) {
      digitalWrite(servopath_pin_ST ,LOW);     // pin 14 - off
      digitalWrite(servopath_pin_DV ,LOW);     // pin 15 - off 
      for(posservo_1 = Servo1MAX; posservo_1>=Servo1MIN; posservo_1-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo1.write(posservo_1);                // tell servo to go to position in variable 'pos' 
   delay(50);                                  // waits 50ms for the servo to reach the position 
  }
  Serial.print(" back to ");
  Serial.print(Servo1MIN);
  Serial.print(" degrees ");
  Serial.println(" Red Light Lit, Points Diverge, Relay set for frog");        
  //Serial.println();  
  servo_1_lastpos = Servo1MIN;
  digitalWrite(servopath_pin_DV ,HIGH);   //set red led on and turn on frog power set relay 7 to conduct 

     
  } // end else
}   // end if led = high
    
}