PIC program LED on off with same push button
Try a 10k pullup resistor on the input pin. Unconnected inputs can float undesirably.







simulate this circuit &ndash; Schematic created using CircuitLab

Try debouncing in software.