How do I use a " wait until " command in the arduino language?

I am trying to make quizbowl buzzers with the arduino.  I have gotten it to work with the nxt, but I want to use the arduino approach, because it is a waste to use the nxt for buzzers when I could be making robots with it... I haven't done much with arduino, in fact I have only looked at a few tutorials and downloaded the software.  But I need to know how to use a "wait until" command so that when a button is pressed a light lights up that on the control box containing the arduino (that corresponds with the button, or buzzer) that was pressed, and the light stays on (waits until) a clear button is pressed. 

I'm sorry if the wording is confusing.

I don't need a whole program, just the command, how to use it, and maybe a rough skeleton of the program


willbob1231 year ago

Try using this in your loop put this code this using one of the input pins and soon as pin '2' in this case receives 5v it will detect it.

buttonState = digitalRead(2); //Tells the board to read pin 2

if (buttonState == HIGH) { //Detects if input pin 2 has voltage

digitalWrite(13, HIGH); //If it does then it will make onboard LED go one for 1

delay(1000); // sec then go off.

digitalWrite(13, LOW);

JaredsProjects (author) 7 years ago
I got my arduino in the mail and now I am trying to use buttons and leds to do specific things, but in your example where it shows "x=digitalRead(some pin)" should there be two equal signs so that it doesn't set "x" to the digitalRead...?, and if you could explain why that works it would be a huge help, because for me to learn I have to know how it works.

Thank you in advance!
JaredsProjects (author) 7 years ago
Thank you,  but what is the extra = sign for in-between the x and the 0?