Perhaps Portb.1 is damaged(from 9V??? through the servo???) if only LED2 works as expected.
Test by replacing LED1 with LED2 and vice versa in your program.
Or try to move LED1 to another pin e.g. portb.5 just in case portb.1 is not correctly configured(depends on PIC as some pins do other things as well).
Remember to change the TRIS register also.
Bill
Portb doesn't see 9 volts if you took a look at my schematic it has a separate power supply.
The potentiometer is what connects to the pic from the servo.
No everything is there and facing rightOne LED works as expected. The sensor and PIC work together. The code looks OK.
Are you by chance missing an IR LED? Maybe that is the one not lighting, or on the wrong pin?
Bookmarks