Skip to content

Instantly share code, notes, and snippets.

@TakesTheBiscuit
Created August 21, 2018 22:10
Show Gist options
  • Save TakesTheBiscuit/ca328cadebd854b655c157e2c69ae8b7 to your computer and use it in GitHub Desktop.
Save TakesTheBiscuit/ca328cadebd854b655c157e2c69ae8b7 to your computer and use it in GitHub Desktop.
monitoring digital pins continuously
void setup() {
//start serial connection
Serial.begin(9600);
//configure pin 2 as an input and enable the internal pull-up resistor
pinMode(2, INPUT_PULLUP);
pinMode(13, OUTPUT);
}
void loop() {
//read the pushbutton value into a variable
int toolheadHome = digitalRead(2);
//print out the value of the pushbutton
Serial.println(toolheadHome);
digitalWrite(13, toolheadHome);
if (toolheadHome == HIGH) {
// good.
} else{
// send it home.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment