Skip to content

Instantly share code, notes, and snippets.

@jerog1
Created January 26, 2014 23:11
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 jerog1/8640727 to your computer and use it in GitHub Desktop.
Save jerog1/8640727 to your computer and use it in GitHub Desktop.
// Jeremy Nir - Physical Computing 2014
// This code turns on an LED to let you know that you're out of aluminum foil.
const int ledPin = 13;
const int inputPin = 2;
void setup() { pinMode(ledPin, OUTPUT);
pinMode(inputPin, INPUT);
}
void loop(){
int val = digitalRead(inputPin);
if (val == HIGH)
{
digitalWrite(ledPin, LOW);
}
else
{
digitalWrite(ledPin, HIGH);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment