Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is my Arduino Program for a 2-way traffic controller (6-LED's) with a push-button. This button, when pressed, should turn the 2 Red LEDs on

Below is my Arduino Program for a 2-way traffic controller (6-LED's) with a push-button. This button, when pressed, should turn the 2 Red LEDs on and all others off and remain this way till the button is pressed again. Currently, when the button is pressed the 2 Red LEDs turn on, but only stay on for the duration of that phase of the loop remaining before it changes back. Does anyone have any suggestions on how to modify the code/interrupt to allow the program to stay with the 2 Red LED's on until the button is pressed again after the initial pressing?

image text in transcribed

image text in transcribed

void setup() { DDRB = Ob00111111; attachInterrupt (digitalPintoInterrupt (2), RED, RISING); HM000 void loop() { PORTB=0b00100001; delay(25000); PORTB=0b00100010; delay(5000); PORTB=0b00001100; delay (20000); PORTB=0b00010100; delay (4000); PORTB=0.00000000; 17 19 void RED() 21 PORTB=0b00000000; 22 23 AREF 3 II DIGITAL (PWM-) 00 UNO POWER ANALOG IN void setup() { DDRB = Ob00111111; attachInterrupt (digitalPintoInterrupt (2), RED, RISING); HM000 void loop() { PORTB=0b00100001; delay(25000); PORTB=0b00100010; delay(5000); PORTB=0b00001100; delay (20000); PORTB=0b00010100; delay (4000); PORTB=0.00000000; 17 19 void RED() 21 PORTB=0b00000000; 22 23 AREF 3 II DIGITAL (PWM-) 00 UNO POWER ANALOG IN

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

Database Support For Data Mining Applications Discovering Knowledge With Inductive Queries Lnai 2682

Authors: Rosa Meo ,Pier L. Lanzi ,Mika Klemettinen

2004th Edition

3540224793, 978-3540224792

More Books

Students also viewed these Databases questions

Question

What is linear transformation? Define with example

Answered: 1 week ago