Question

Arduino Design a traffic lights controller for a road intersection : The intersection is between a...

Arduino

Design a traffic lights controller for a road intersection :

  • The intersection is between a major and minor road ( major road traffic is to be prioritized )
  • Pedestrian crosswalks have push buttons for activating pedestrian lights ( 2 buttons for each direction )
  • Use a speaker for visually impaired pedestrians ( one speaker is sufficient – use a piezo Arduino speaker)
  • The minor road has a car detection sensor (use a push button)
  • You are to document both design of the controller and the implementation
    Other than high-level requirements, the details are up to you ( timing, how the speaker beeps – frequency, does it beep faster as the timing ends, etc, etc)

Homework Answers

Answer #1

int Lane1[] = {13,12,11}; // Lane 1 Red, Yellow and Green

int Lane2[] = {10,9,8};// Lane 2 Red, Yellow and Green

int Lane3[] = {7,6,5};// Lane 3 Red, Yellow and Green

int Lane4[] = {4,3,2};// Lane 4 Red, Yellow and Green

void setup()

{

for (int i = 0; i < 3; i++)

{

pinMode(Lane1[i], OUTPUT);

pinMode(Lane2[i], OUTPUT);

pinMode(Lane3[i], OUTPUT);

pinMode(Lane4[i], OUTPUT);

}

for (int i = 0; i < 3; i++)

{

digitalWrite(Lane1[i], LOW);

digitalWrite(Lane2[i], LOW);

digitalWrite(Lane3[i], LOW);

digitalWrite(Lane4[i], LOW);

}

  

}

void loop()

{

digitalWrite(Lane1[2], HIGH);

digitalWrite(Lane3[0], HIGH);

digitalWrite(Lane4[0], HIGH);

digitalWrite(Lane2[0], HIGH);

delay(7000);

digitalWrite(Lane1[2], LOW);

digitalWrite(Lane3[0], LOW);

digitalWrite(Lane1[1], HIGH);

digitalWrite(Lane3[1], HIGH);

delay(3000);

digitalWrite(Lane1[1], LOW);

digitalWrite(Lane3[1], LOW);

digitalWrite(Lane1[0], HIGH);

digitalWrite(Lane3[2], HIGH);

delay(7000);

digitalWrite(Lane3[2], LOW);

digitalWrite(Lane4[0], LOW);

digitalWrite(Lane3[1], HIGH);

digitalWrite(Lane4[1], HIGH);

delay(3000);

digitalWrite(Lane3[1], LOW);

digitalWrite(Lane4[1], LOW);

digitalWrite(Lane3[0], HIGH);

digitalWrite(Lane4[2], HIGH);

delay(7000);

digitalWrite(Lane4[2], LOW);

digitalWrite(Lane2[0], LOW);

digitalWrite(Lane4[1], HIGH);

digitalWrite(Lane2[1], HIGH);

delay(3000);

digitalWrite(Lane4[1], LOW);

digitalWrite(Lane2[1], LOW);

digitalWrite(Lane4[0], HIGH);

digitalWrite(Lane2[2], HIGH);

delay(7000);

digitalWrite(Lane1[0], LOW);

digitalWrite(Lane2[2], LOW);

digitalWrite(Lane1[1], HIGH);

digitalWrite(Lane2[1], HIGH);

delay(3000);

digitalWrite(Lane2[1], LOW);

digitalWrite(Lane1[1], LOW);

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT