Hello,
I am having a problem getting my button to respond to the following code. I am trying to be able to give the user 1 minute to push the button and turn on an LED before the rest of my code runs. BUT... something is not working properly. Can anyone identify my problem?
Thank you,
Jason
const int buttonPin = 3;
const int ledPin =1;
unsigned long time;
void setup () {
pinMode(buttonPin,INPUT);
pinMode(ledPin,OUTPUT);
}
void loop(){
int buttonState;
buttonState = digitalRead(buttonPin);
time = millis();
while(time < 60000){
if (buttonState ==LOW)
{
digitalWrite(ledPin,HIGH);
}
else{
digitalWrite(ledPin,LOW);
}}}