Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***VERY URGENT, THIS IS AN ARDUINO QUESTION. PLEASE ANSWER FAST, I WILL UPVOTE YOUR ANSWER**** //variables int YELLOW = 3; int RED = 4; int

***VERY URGENT, THIS IS AN ARDUINO QUESTION. PLEASE ANSWER FAST, I WILL UPVOTE YOUR ANSWER****

//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);

}

Based on the previous example add a button as input and modify the program,

As can be seen from the program, the green LED should be lighted ON. Press the button and the yellow LED should light and followed by red LED when pressed again. Add the following new type: Typedef enum {GREEN

Change the parameter to the light_one_led to colors instead of int.

Change the 1, 2, 3, in the call to GREEN, YELLOW, RED

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

From Zero To Data Hero With Chatgpt

Authors: Andrew Wu

1st Edition

B0CQRJPXD9, 979-8989523009

More Books

Students also viewed these Databases questions

Question

3-26. Was the senders purpose realistic?

Answered: 1 week ago