Pls Help!!!

Hey Guys,
I need to submit my project tomorrow. I can’t figure out what’s wrong with it though. I want to do a Density Based 4-way traffic light system using ultrasoonc sensor and arduino mega. What I want is -

  1. when the distance is equal on all sensors, I want it to follow a regular pattern and timing
  2. when one sensor has a lower distance, I want the led of that sensor to change to green and rest of the sensors to red

I am pretty sure I have connected everything right.

I wanted to confirm the code using a 2 way system first, but I can’t figure it out.

Final.ino (2.57 KB)

I would try comparing distance1 to distance2 (distance1 == distance2) instead of assigning the value of distance2 to distance1 (distance1 = distance2)

Did You discouver the date of submitting Your project today? That sounds like "urgent", a reason that is not accepted here.

If You have cut Yourself on the knife, apply a bandage. If You know You might cut Yourself, plan for awoiding it.

That answer is as helpful as it is correctly spelled.

Railroad,
I was trying to finish it up myself these days, thought I could.