Created
August 21, 2018 22:10
-
-
Save TakesTheBiscuit/ca328cadebd854b655c157e2c69ae8b7 to your computer and use it in GitHub Desktop.
monitoring digital pins continuously
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
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