Skip to content

Instantly share code, notes, and snippets.

@peverett
Created September 13, 2016 19:13
Show Gist options
  • Save peverett/3faf0d7039f746ccaced8be164d52497 to your computer and use it in GitHub Desktop.
Save peverett/3faf0d7039f746ccaced8be164d52497 to your computer and use it in GitHub Desktop.
// Maple Lead Mini
// Uses pulldown on input.
// Waits for serial connection.
const int inPin = 22;
int val;
void setup() {
// put your setup code here, to run once:
pinMode(inPin, INPUT_PULLDOWN);
Serial.begin(9600);
while(!Serial);
Serial.println("Serial connected.");
}
void loop() {
// put your main code here, to run repeatedly
val = digitalRead(inPin);
if (val) {
Serial.println("");
Serial.println("Button press detected");
}
else {
Serial.print(".");
}
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment