Hi. I want to control led using servo. let me explain
The thing will be that when the position of servo will be 0 degree then the red led will glow and when the servo position will be 90 degrees the the red led will stop glowing. Along with this, when the servo position will be 0 degrees green led will not glow and when servo position is 90 degrees then the green led will glow.
Like this,
if Servo position = 0
Red led = True
and Green led = False
if Servo position = 90
Red led = False
and Green led = True
you need to read about the servo library and probably study the blink without delay example (or read the post about millis() that is anchored at the top of the forum)
Do you mean that literally or do you mean that when the servo is commanded to go to position 0 the Arduino also turns on the red LED etc ?
What code have you tried ?
Have you looked at the Servo Sweep code in the IDE ?
Have you tried modifying it to turn LEDs on/off when the servo is at the relevant positions ?
What type of servo are you using ?
How is the servo powered ?