There are a couple of ways to do what you want.
One way is to put all your code into setup like this:
void setup ()
{
pinMode( LED, OUTPUT ) ; // Sets the digital pin as output.
digitalWrite( LED, HIGH); //Turn the Led on
delay(4000); // Waits for
digitalWrite(LED, LOW); // Turns led off
delay (4000) ; // Waits for
digitalWrite( LED, HIGH); //Turn the Led on
delay(500); // Waits for
digitalWrite(LED, LOW); // Turns led off
delay(500); // Waits for
}
void loop()
{
}
Another way is to add while(1) or for( ; ; ) at the end of loop. Either of these is always satisfied so the code will hang at those lines.
# define LED 13 // LED connected to
//digital pin 13
void setup ()
{
pinMode( LED, OUTPUT ) ; // Sets the digital pin as output.
}
void loop()
{
digitalWrite( LED, HIGH); //Turn the Led on
delay(4000); // Waits for
digitalWrite(LED, LOW); // Turns led off
delay (4000) ; // Waits for
digitalWrite( LED, HIGH); //Turn the Led on
delay(500); // Waits for
digitalWrite(LED, LOW); // Turns led off
delay(500); // Waits for
while(1); // this will loop forever right here
}