Computer Science Canada Need help with parallelput |
Author: | chroncile [ Sun Jan 11, 2009 8:05 pm ] |
Post subject: | Need help with parallelput |
Hi, I'm supposed to make a program that has two modes, a test and a quiz mode. When the user is taking the quiz, the LED lights on the breadboard are suppose to turn off every 1 second using parallelput. The quiz is multiple choice and its GUI so there are four boxes from which the user can choose. Also, I have to use mousewhere and not buttonwait for it since buttonwait will it so that the LED lights wont go off. |
Author: | Laplace's Demon [ Sun Jan 11, 2009 8:20 pm ] |
Post subject: | Re: Need help with parallelput |
Alright...all you've done here is tell us what your project is. Do you have any code to post for us? Do you have any specific questions? This forum is not to be used to bum code, it is used to answer specific questions pertaining to existing code. If you have any reasonable specific questions and can provide us with the code you have written so far, we could help out. |
Author: | chroncile [ Sun Jan 11, 2009 8:34 pm ] | ||
Post subject: | RE:Need help with parallelput | ||
yes, how do i make it so when the user is answering the questions, the LED lights go off. Im suppose to use 4 LED lights and one by one, they turn off meaning a second has passed by and when they all turn off, the program goes to the next question, here is my code so far:
|
Author: | Laplace's Demon [ Sun Jan 11, 2009 8:47 pm ] |
Post subject: | Re: Need help with parallelput |
Are you asking how to use the parallelput procedure? First of all, don't use the "wait" procedures. They will muck up your program. All you need to do is run a loop in the question section of your program, which is constantly checking for the answers. In this loop you also want to keep a timer of some sort, whether you do that in terms of "frames" in the game or by actual time is up to you. Based on that timer you want to turn off LED 1 after 1 second, turn off LED 2 after 2 second, etc. Then after all four have turned off and four seconds have passed you want to exit the "question loop" and tell the user time has run out. |
Author: | chroncile [ Sun Jan 11, 2009 8:54 pm ] |
Post subject: | RE:Need help with parallelput |
Nope, what I want is for the LED lights on the breadboard to turn off one by one. Like, when the user is taking the quiz, they will have only 4 seconds to answer the question and to display how many seconds they have, one of the four LEDs will turn off every second. Just to clarify; there is a breadboard with 4 LED lights, when a user is doing the quiz, all the LED lights will be on, but as the user is answering the questions, he or she will only have 4 seconds to choose an answer and to display how many seconds are left, one by one the LEDs will turn off each second. I have to make that using mousewhere and parallelput. How? Thx ![]() |
Author: | Laplace's Demon [ Sun Jan 11, 2009 9:08 pm ] |
Post subject: | Re: Need help with parallelput |
I edited my previous post with more information. To use Mouse.Where simply have Mouse.Where at the top of your "question loop" and in your loop check to see if the mouse button is down while the cursor is simultaneously over your button. Parallelput can be a little finicky. But basically you just want to input a value in the parameter of the procedure which will activate your desired LEDs. For example to light up all four, you might use parallelput (1+2+4+8=15) but to light up only the first three you might use parallelput (1+2+4=7) If you had 8 LEDs and you wanted to light all of them up, you would use 255, etc. Go check out the turing reference on these subjects, if you take the time to read through a few time it can all click. |
Author: | chroncile [ Sun Jan 11, 2009 9:39 pm ] | ||
Post subject: | RE:Need help with parallelput | ||
Hey, thanks for the help, but I have a bit of a problem, when the program starts, it doesn't display anything ![]() Try it yourself:
|
Author: | Laplace's Demon [ Sun Jan 11, 2009 10:22 pm ] |
Post subject: | Re: Need help with parallelput |
It is displaying something, it is just doing it so fast that your program finishes and clears immediately. Try opening the debugger menu and check "trace execution" you will see that it actually does work. Just stick a delay (1000) right below your "exit when timer = 4 or counter = 1" line and it will work like you want it to (sort of). You will also want to stick delays in the part after the question loop, so that the player has time to read whether or not they got the correct answer. |