Created
September 2, 2016 23:41
-
-
Save maxpromer/d8f94ccf25e3912429c7cad9ef09adf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define SW1 A0 | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(9600); | |
pinMode(SW1, INPUT); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
if (digitalRead(SW1)) { | |
long StartMS = millis(); | |
bool longSW = false; | |
while(digitalRead(SW1)) { | |
if (millis() - StartMS > 5000) longSW = true; | |
} | |
Serial.println(longSW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment