Hello,
I'm a newbie at programming and using Arduino and have an issue I cannot figure out. For the coding example below, it loops the lights continuously. How do I change the coding so that it doesn't loop?
/* A simple program to sequentially turn on and turn off 3 LEDs */
int LED1 = 13;
int LED2 = 12;
int LED3 = 11;
int LED4 = 10;
Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Put the code in setup. The code will only run one time.
Here is your code with modified. Note that the code is formatted with the autoformat tool and posted in code tags.
/* A simple program to sequentially turn on and turn off 3 LEDs */
int LED1 = 13;
int LED2 = 12;
int LED3 = 11;
int LED4 = 10;
void setup()
{
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
digitalWrite(LED1, HIGH); // turn on LED1
digitalWrite(LED4, HIGH); // turn on LED4
delay(500);
digitalWrite(LED4, LOW); // turn off LED4
delay(500);
}
void loop()
{
}