Need some help with a project!
Author |
Message |
Gooners
|
Posted: Mon Jan 05, 2009 7:54 pm Post subject: Need some help with a project! |
|
|
Hi everyone!
This is my first post here, and this forum looked like an excellent place to get some information on this language.
I'm currently a high school student in Grade 10 who's having some trouble with an assignment for my Computer Engineering Technology course.
Heres my problem:
Quote: Project Description:
Popular game shows like Jeopardy ask the contestants various questions. The contestants provide their answers by pressing a pushbutton ?ANSWER? switch. The first person to push their ?ANSWER? switch gets to answer the question.
This project involves the design, documenting and building of a hardware circuit which performs the same function as the game show ?ANSWER? switches. The hardware circuit consists of four pushbutton switches all mounted on a game panel or as an individual switch on a hand held device. There are also four LEDs mounted above each switch on the game panel or on each hand held device. The LED lights up to indicate the winner who pushed the switch first. Each switch is connected to an input pin on the parallel port via the parallel port cable.
You will also write and debug a game program. The game will start by either playing a musical sound or asking a question. After a random delay between 1 and 4 seconds, the contestants will be told to push their ?ANSWER? switches. The first contestant to push their ?ANSWER? switch wins the game and the LED for the winning contestant is turned on. Your program will also display a graphical image of the game panel or hand held devices showing the LEDs. The LEDs will turn on and off for each winner. The first player to win five games is declared the overall winner and the program stops.
Materials: four pushbutton switches, four 10K resistors, four 200 ohm resistors, four LEDs, parallel port cable, wire.
Construction and Wiring Requirements
?
Draw and label a circuit schematic showing all of the components and wiring connections before you start wiring the circuit. The schematic drawing can be hand written or done using a software program such as Word or a schematic drawing application.
?
Ensure your pushbutton switches are securely mounted to the game panel or the hand held device.
?
Ensure connecting wires are tightly twisted together and insulated to avoid short circuits with other wires.
?
Ensure the leads of the LEDs are insulated from each other to avoid short circuits.
?
Label your wires with the parallel port pin numbers.
Programming Requirements
?
The program will detect which pushbuttons are pressed and turn on the corresponding LED. The program will also display an accurate, graphical representation of the LEDs in your circuit. These graphic LEDs will turn on and off whenever the LEDs in the hardware circuit are turned on or off.
?
Ensure your program has a proper header and is fully commented.
?
Store your completed program in the 4Students folder specified by the teacher.
I have already successfully completed the construction components, and I need help with the programming.
The game needs to work like this:
4 people playing
each of them have a button to press
a question is given and whoever presses first gets to answer it
if they get a question right they get a point
this continues till someone gets 5 points
If anyone needs a picture of the wired breadboard please ask.
I've no clue where to start as our teacher doesn't teach very well.
Thanks a lot
[/quote] |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Gooners
|
Posted: Mon Jan 05, 2009 7:55 pm Post subject: RE:Need some help with a project! |
|
|
I'm very sorry, just saw the sticky asking for members not to post Need help in their topic titles. |
|
|
|
|
![](images/spacer.gif) |
Gooners
|
Posted: Mon Jan 05, 2009 8:12 pm Post subject: RE:Need some help with a project! |
|
|
Okay thank you, It's my first time on an internet forum
So to create the 4 buttons i use drawfilloval, but then what? How would i assign them to four different keys?
Thank you very much, I'm extremely grateful |
|
|
|
|
![](images/spacer.gif) |
Laplace's Demon
|
Posted: Mon Jan 05, 2009 8:41 pm Post subject: Re: Need some help with a project! |
|
|
I am afraid that there is too much involved in the program you are creating for us to answer every question. You will come along many problems as you develop this program. The best way to learn in to try to tough it out and make good use of the turing reference and existing help and tutorial threads on this forum.
That said, in reference to your question, look up GUI.CreateButton[Full] |
|
|
|
|
![](images/spacer.gif) |
Gooners
|
Posted: Mon Jan 05, 2009 8:46 pm Post subject: RE:Need some help with a project! |
|
|
Would it be better off if i made seperate threads? Do you happen to have XFire? |
|
|
|
|
![](images/spacer.gif) |
Laplace's Demon
|
Posted: Mon Jan 05, 2009 9:00 pm Post subject: Re: Need some help with a project! |
|
|
mmm....well you could keep making separate threads for each and every question. But for the sake of this boards sanity and for your own actual learning, try to work through the problems yourself for a while before you ask here. Look at existing threads and tutorials, your question is more than likely already answered somewhere else. |
|
|
|
|
![](images/spacer.gif) |
Gooners
|
Posted: Mon Jan 05, 2009 9:03 pm Post subject: RE:Need some help with a project! |
|
|
Yea, I've been looking, it's jsut really hard, our teacher didn't even give us any notes, our whole class is ready to fail this final project.
I looked up GUI Create button and I am jsut confused, don't know where to start ![Neutral Neutral](http://compsci.ca/v3/images/smiles/icon_neutral.gif) |
|
|
|
|
![](images/spacer.gif) |
syntax_error
![](http://compsci.ca/v3/uploads/user_avatars/196798963948cf16794b6e5.jpg)
|
Posted: Mon Jan 05, 2009 9:20 pm Post subject: RE:Need some help with a project! |
|
|
No.
Do not use the Turing GUI, it has many bugs and will make the task seem much more complex.
Look up mouse.where and create your own buttons, much cleaner. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Mon Jan 05, 2009 11:28 pm Post subject: RE:Need some help with a project! |
|
|
I've just skimmed over the topic, but it seems that the assignment involves building the hardware for buttons. So some points:
- Don't bother with the GUI module, it's not applicable for this.
- Don't bother with Mouse.Where, unless you want to use the mouse pointer as another input device.
- Don't rush into drawing with Draw.FillOval. You could have pretty drawings in the final product, but it's easier to develop the difficult part (building and testing hardware switches and LED lights) if you were to work in the text mode.
-- you can later come back and replace "put 'player 1 wins' with "super_awesome_procedure(winning_player)". |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Gooners
|
Posted: Mon Jan 05, 2009 11:36 pm Post subject: RE:Need some help with a project! |
|
|
Thanks tony, the hardware works, it's jsut the program, i tested the hardware on someone elses program, but have no clue how to write my own.
Our teacher doesn't even give us notes to take down ![Sad Sad](http://compsci.ca/v3/images/smiles/icon_sad.gif) |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Mon Jan 05, 2009 11:50 pm Post subject: RE:Need some help with a project! |
|
|
look up PC.ParallelGet in Turing's help file.
Each pin has a unique value that is a power of 2. The overall state is a sum of the pins that are high (active). (so if more than one person is holding a button down at the same time, the result will be a sum, but the individual parts could be figured out).
From the documentation, start by running a simple loop like
Turing: |
var val : int
loop
val := PC.ParallelGet(1)
locate(1, 1)
put "Pin 10 is: ", (val div 64) mod 2
put "Pin 11 is: ", (val div 128) mod 2
put "Pin 12 is: ", (val div 32) mod 2
put "Pin 13 is: ", (val div 16) mod 2
put "Pin 15 is: ", (val div 8) mod 2
end loop
|
and play around with your hardware while it's hooked up and the loop is running. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Gooners
|
Posted: Tue Jan 06, 2009 12:05 am Post subject: RE:Need some help with a project! |
|
|
Thx Tony |
|
|
|
|
![](images/spacer.gif) |
|
|