Hello everyone
I'm beginner for this and sorry for my english language
I need a pic 16f877a program in PIC C Complier
one switch control the led On at time one press
next press the LED will OFF
but my problem is when i press and hold the switch button, it's toggle
" how can i fix this code for stop toggle LED when i press and hold the button "
since your condition is within while loop, it will be keep on executing. Better use switch input as interrupt. So when you press then only control will go to that function and execute only once till you press again.