loading

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


willbob1237 months 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);