Posted: Thu May 01, 2008 4:59 pm Post subject: Traffic light program HELP!!!
Hello this is Gundra27!
I'm in computer engineering class and I'm kind of having trouble with traffic light program with Turing Please help.
var Gtime, Ytime, Rtime : int
var G, Y, R : int
procedure G1
if parallelget = 120 then
G:=1
parallelput (G)
delay (10000)
end if
if parallelget = 56 then
G:= 4
parallelput (G)
delay (1000)
end if
end G1
procedure Y1
if parallelget = 120 then
Y:= 2
parallelput (Y)
delay (2000)
end if
if parallelget =56 then
Y:=2
parallelput (Y)
delay (2000)
end if
end Y1
procedure R1
if parallelget = 120 then
R:=4
parallelput (R)
delay (10000)
end if
if parallelget =56 then
R:=1
parallelput (R)
delay (1000)
end if
end R1
loop
G1
Y1
R1
end loop
When light is on Red and whenever i push the button then it will take one second and change to green. But I having trouble with responding of button with program. My teacher said there is no problem with circuit board and told me that there is problem with
program please help me to advance this program.
Sponsor Sponsor
andrew.
Posted: Thu May 01, 2008 6:12 pm Post subject: Re: Traffic light program HELP!!!
I didn't take computer engineering (although I wish I could've), but I think that you need to take out the delay (1000) in your code. That's what's causing it to delay. If you want, just put delay (100) or whatever in your loop.