Skip to content

Instantly share code, notes, and snippets.

@norcal82
Created February 26, 2014 23:17
Show Gist options
  • Save norcal82/9240870 to your computer and use it in GitHub Desktop.
Save norcal82/9240870 to your computer and use it in GitHub Desktop.
Arduino Continuity Check
const byte ledPin = 13; // choose the pin for the LED. attiny85 = 0; teensy = 11
const byte inPin1 = 1; // choose the input pin
bool val = 0; // variable for reading the pin status
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inPin1, INPUT); // declare as input
digitalWrite(inPin1, HIGH); //enable pull up resistor
}
void loop(){
//ground inPin1 to get continuity. toggle led when triggered
val = digitalRead(inPin1); // read input value
if (val == HIGH) { // check if the input is HIGH (if no cont..)
digitalWrite(ledPin, LOW); // turn LED OFF
} else {
digitalWrite(ledPin, HIGH);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment