Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Traffic light program HELP!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Gundra27




PostPosted: 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
Sponsor
sponsor
andrew.




PostPosted: 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.

Example:

Turing:
loop
parallel stuff blah blah blah
delay (100)


Just remember to take out the other delays.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: