About Traffic light controller.

This is a discussion on About Traffic light controller. within the C++ Programming forums, part of the General Programming Boards category; Hi everyone. I need help. Actually this is one of my homework assignment. It says we need to design a ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    32

    About Traffic light controller.

    Hi everyone. I need help. Actually this is one of my homework assignment. It says we need to design a traffic light controller using both software and hardware language. I am not here looking for solution. I guess I can ask the problem here. Actually, the assignment does not restrict us any thing about design a traffic light controller. We need first to design in software then write in a hardware one. My question is that I don't know how to define a proper input
    and output so that I can show it is real a traffic light simulator.

    Because I need to implement both in SW and HW. I think I should define before I start to code. The spec or functionality is all free. I can design as it function like a traffic light simulator.

    Somehow, based on my limited skill and programming experience. This kind of spec let me really confused. There is a hint of assignment: It says I can draw a block diagram for the traffic light first and determine the message flow between each block. That will make HW implement easier... My question is this kind of spec somehow seems "abstract" for me. I don't know how
    I should let the simulator looks light a traffic light. If I am not able to implement in GUI, how should I define the input/output of this question? If anyone who's also familiar with hardware language, please tell me what kinds of I/O I can deal with this kind of problem?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I don't know exactly what you mean by input/output for a traffic light. I suppose the output at any given time could be "which light is on". Your basic traffic light doesn't necessarily have any input, although you can do traffic sensors or "push to walk" buttons if you want I guess.

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    32
    Thx for reply.

    Maybe I should ask this way. For this kind of problem, if I need to let the executable binary works like a traffic light simulator. Is it like when I execute the program, it will automatically generate a output file describe something like
    time up down left right
    0 5/Red 10/Red Passing/Green passing/Green
    ...
    ...
    ...

    This is one of output format I can think of (This is a simple crossroad)
    which means at time zero up/down direction are red light, 5/10 waiting in the line.
    And left/right direction are green light, cars are passing.

    does this work as the assignment want? The spec does not define any specific input or output format. I just have no idea.

    How would you define such a output to let it works like a traffic light simulator?

    Actually, this kinds of question can be expanded. This is classical Finite state machine. I know what FSM is. Though I have no idea how should I implement FSM in SW so that it works like a FSM. Please help my stupid question

  4. #4
    Registered User
    Join Date
    Feb 2010
    Posts
    32
    Any advice would much be appreciated. Thx

    Actually I got one another similar FSM question.
    That is if it is to model elevator simulator.

    Normally, should I model state as direction such as states up/down/stop/doorOpen/doorClose/

    Or I should model states according to the floor car stays. Such as ground floor/ 2F/ 3F / ... NF/

    It just confused me. Thx for help

  5. #5
    Your imaginary friend
    Join Date
    Jan 2010
    Location
    Canada
    Posts
    75
    You could make a random number for the green/red lights, and for the floor the elevator needs to go

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  2. geometry won't display!?
    By psychopath in forum Game Programming
    Replies: 17
    Last Post: 09-21-2004, 10:10 AM
  3. Replies: 4
    Last Post: 06-30-2004, 03:11 PM
  4. How many forums members to change a lightbulb.
    By adrianxw in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 01-01-2004, 07:31 PM
  5. A Common Scientific Belief
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 03-29-2002, 04:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21