Skip to content

Instantly share code, notes, and snippets.

@NicolasFrancaX
Created June 2, 2013 23:41
Show Gist options
  • Save NicolasFrancaX/5695371 to your computer and use it in GitHub Desktop.
Save NicolasFrancaX/5695371 to your computer and use it in GitHub Desktop.
const int buttonPin = 8;
const int ledPin = 2;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop(){
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment