1.Start
2.Set the Greenlight duration = 50s
3.Set the Amberlight duration = 20s
4.Set the redlight duration = Greenlight duration
+ Amberlight duration
5.Set walkrequest = false
6.Set card detected = false
7.While true
a.Display “ Red light Is on!!”
8.Prompt for walkrequest
9.If walkrequest is pressed
a.Set walkrequest = true
b.Display (“walk request detected”)
c. Reduced the redlight duration by 10
seconds
10. Prompt for car detection
11. If car is detected on the light
a.Set car detection = true
b.Display (“ car detected at the red light”)
c. If detected cars are more than 5
i. Reduced the wait time by 10 seconds
12. Wait for redlight duration seconds
13. Reset to step 4
14. end