0% found this document useful (0 votes)
47 views1 page

LED Control Sequence in C++

This C++ code is designed for controlling three LEDs connected to pins 9, 7, and 4. In the setup function, these pins are set as outputs, and in the loop function, the LEDs are turned on and off in a specific sequence with delays of 5 seconds for green, 3 seconds for yellow, and 5 seconds for red. The loop continuously repeats this sequence.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

LED Control Sequence in C++

This C++ code is designed for controlling three LEDs connected to pins 9, 7, and 4. In the setup function, these pins are set as outputs, and in the loop function, the LEDs are turned on and off in a specific sequence with delays of 5 seconds for green, 3 seconds for yellow, and 5 seconds for red. The loop continuously repeats this sequence.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

// C++ code

//

int Rojo = 9;

int Amarillo = 7;

int Verde = 4;

void setup()

pinMode(Rojo, OUTPUT);

pinMode(Amarillo, OUTPUT);

pinMode(Verde, OUTPUT);

void loop() {

digitalWrite(Verde,1);

delay(5000);

digitalWrite(Verde,0 );

digitalWrite(Amarillo,1);

delay(3000);

digitalWrite(Amarillo,0);

digitalWrite(Rojo,1);

delay(5000);

digitalWrite(Rojo,0);

You might also like