int main
{
~~
}
while(1)
{
~
while(1) <-----here while statement
{
~
}
}
When executing the second while statement
How do I give an input to a button and execute the code for the input?
The button is connected to PG1, so if an input is given rather than an interrupt, the command is executed.
I don't know why the second infinite loop is needed.
You need to consider how to get out of the second infinite loop.
Switch check is not difficult.
if(PING&2){} // Check if the switch is HIGH when pressed
if((PING&2)==0){} // Check if LOW when the switch is pressed