author

Luis AndrésG

Inbox View Profile
7Comments

Tell us about yourself!

  • Thanks so much for uploading the code. I see now. Maybe I wasn't clear (sorry, english is not my native language) but the problem is the following. Let's look at the serial output9090 <- I pressed the button, gives 9090 (random timer initialized and waiting for reaction on led lightup)1010 <- I pressed the button early, so it gives code 1010 (early response). The game PAUSES infinitely until I press the button again (which is the appropriate behavior)9090 <-pressed the button again, but this time I will not press any button to test the timeoutTimed out <-success! it timed out and didn't output the reaction timemessage <- your suggestion has been executed9090 <- ***HERE***, the game starts, without waiting for my response! (which is inappropriate). Timed out <- it will…

    see more »

    Thanks so much for uploading the code. I see now. Maybe I wasn't clear (sorry, english is not my native language) but the problem is the following. Let's look at the serial output9090 <- I pressed the button, gives 9090 (random timer initialized and waiting for reaction on led lightup)1010 <- I pressed the button early, so it gives code 1010 (early response). The game PAUSES infinitely until I press the button again (which is the appropriate behavior)9090 <-pressed the button again, but this time I will not press any button to test the timeoutTimed out <-success! it timed out and didn't output the reaction timemessage <- your suggestion has been executed9090 <- ***HERE***, the game starts, without waiting for my response! (which is inappropriate). Timed out <- it will continue to loop these 3 messages up to infinitymessage9090So, that was the problem I need to solve.

    That seems to work, kinda!!http://pastebin.com/NADJMRjmNow the problem is the following:When the maximum time has elapsed, it doesn't return to the same point as if there was a correct or early answer, which is wait for the next time the user presses the button. It keeps looping game after game. Any ideas?

    No, this is not what is intended. Let me rephrase it:wait for a button press. once this happens, a led blinks once indicating the game begins. "9090" is printed in the serial (is a code that sends a signal to the PC to play a sound).after a random lapse, the led lights up, and a clock starts to measure the time until you press the button again. In this lapse of time, nothing is printed. if you press the button after the light is turned on, it shows the reaction time in seconds (which the computer stores in a CSV file). if you press before the led lights up, it blinks three times and the game ends. ("1010" is a code that signals the PC to play an error sound). it then should return to an idle state and return to step 1. if you don't press the button after a time, the le…

    see more »

    No, this is not what is intended. Let me rephrase it:wait for a button press. once this happens, a led blinks once indicating the game begins. "9090" is printed in the serial (is a code that sends a signal to the PC to play a sound).after a random lapse, the led lights up, and a clock starts to measure the time until you press the button again. In this lapse of time, nothing is printed. if you press the button after the light is turned on, it shows the reaction time in seconds (which the computer stores in a CSV file). if you press before the led lights up, it blinks three times and the game ends. ("1010" is a code that signals the PC to play an error sound). it then should return to an idle state and return to step 1. if you don't press the button after a time, the led blinks twice and the game ends. returns to step 1. (another code goes here, i haven't thought of it yet). once the game ends, it only begins again if you press the button again. What must not happen, and is happening even with your last code, is that after a "Timed out", it shouldn't return to a code 9090. It should stay idle until a button is pressed. In this last coude you moved 9090 to a place where it's not meant to be. Thank you for your patience! This seems arbitrary but it must follow this specification because it is intended to work on animals (which is my field of research).

    @86! While I was trying to solve this method, I got suggested to try machine state approach. I revamped completely the code and for now it works, somehow. The only problem is to get the correct reaction time. Check it out. http://pastebin.com/4prEbN0W

    View Instructable »
  • Great code!I've adapted your code to do something more complex. The problem I've found is that I cannot figure out how to program it to print a message if a certain amount of time has passed and the user didn't pushed the button AFTER the game has started. Here's my adapted code: http://pastebin.com/kMsBkVyj

    View Instructable »