Question: Explain how this code for Arduino works and construct a circuit based on this //variables int YELLOW = 3; int RED = 4; int DELAY_YELLOW

Explain how this code for Arduino works and construct a circuit based on this

//variables

int YELLOW = 3;

int RED = 4;

int DELAY_YELLOW = 1000;

int DELAY_RED = 1000;

// basic functions

void setup()

{

pinMode(YELLOW, OUTPUT);

pinMode(RED, OUTPUT);

}

void loop()

{

yellow_light();

delay(DELAY_YELLOW);

red_light();

delay(DELAY_RED);

}

void yellow_light()

{

digitalWrite(YELLOW, HIGH);

digitalWrite(RED, LOW);

}

void red_light()

{

digitalWrite(YELLOW, LOW);

digitalWrite(RED, HIGH);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!