Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using an Arduino. Modify our original traffic light to have 2 sides, and let the user enter the time (in seconds for each color [red,

Using an Arduino. Modify our original traffic light to have 2 sides, and let the user enter the time (in seconds for each color [red, yellow, green]

We want the user delay to override the delay I have given as default value permanently.

I use a MEGA 2560 Arduino.

This is my origonal code.

int ledDelay = 2000; int redPin = 10; int yellowPin = 9; int greenPin = 8;

void setup() { pinMode(redPin, OUTPUT); pinMode(yellowPin, OUTPUT); pinMode(greenPin, OUTPUT); }

void loop() { // turn red on digitalWrite(redPin, HIGH); delay(ledDelay);

digitalWrite(redPin, LOW); digitalWrite(yellowPin, HIGH); delay(ledDelay);

digitalWrite(greenPin, HIGH); digitalWrite(yellowPin, LOW); delay(ledDelay);

digitalWrite(yellowPin, HIGH); digitalWrite(greenPin, LOW); delay(ledDelay);

digitalWrite(yellowPin, LOW);

}

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_2

Step: 3

blur-text-image_3

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions