Skip to content

Instantly share code, notes, and snippets.

@maxpromer
Created September 2, 2016 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxpromer/d8f94ccf25e3912429c7cad9ef09adf0 to your computer and use it in GitHub Desktop.
Save maxpromer/d8f94ccf25e3912429c7cad9ef09adf0 to your computer and use it in GitHub Desktop.
#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