how to add led to my code

hi i have a code for a servo poss 1 0 poss 2 180 i need to add 2 leds to tell me what poss the servo is in i found the code online and it works for me im new to arduino if i post the code could any one help please


First, do you know how to wire a led? If no, search for tutorials on the web.
You need 2 leds and 2 resistors. Here is an example for one led:

Then you choose 2 pins to wire the leds, on this example the pin is the digital 13.

byte led1 = 13; // the pin the LED is connected to
byte led2 = 15; // the pin the LED is connected to

In your code, you need to declare these pins as OUTPUT

  pinMode(led1, OUTPUT) // Declare the LED 1 as an output
  pinMode(led2, OUTPUT) // Declare the LED 2 as an output

And you need to write instructions to light the leds depending on the servo position:

     if( sw1){
       sw1 = false;
       digitalWrite (led1,HIGH);
       digitalWrite (led2,LOW);
     else if( sw2){
       sw2 = false;
       digitalWrite (led2,HIGH);
       digitalWrite (led1,LOW);