const int ledPin = 2;
const int floatSwitch = 4;
int floatStatecounter = 0;
int buttonState = 0;
long lastButtonState = 0;
long failSafe = 5000;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(floatSwitch, INPUT);
Serial.begin(9600);
}
void loop() {
//get switch state
buttonState = digitalRead(floatSwitch);
if (floatSwitch == HIGH){
floatStatecounter = millis();
}
if (millis() >= 5000){
digitalWrite(ledPin, HIGH);
}
Serial.println(buttonState);
delay(10);
}
Ok, Im getting the LED to light right when the switch falls to HIGH.
I think it has to do with this right here
if (floatSwitch == HIGH){
floatStatecounter = millis();
}
if (millis() >= 5000){