Skip to content

Instantly share code, notes, and snippets.

@t-kashima
Last active August 29, 2015 14:21
Show Gist options
  • Save t-kashima/c697c1c264355864a70a to your computer and use it in GitHub Desktop.
Save t-kashima/c697c1c264355864a70a to your computer and use it in GitHub Desktop.
Slide switch and LED for Arduino
void setup() {
// put your setup code here, to run once:
pinMode(12, OUTPUT);
pinMode(13, INPUT);
pinMode(11, OUTPUT);
digitalWrite(12, HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(13) == HIGH) {
digitalWrite(11, HIGH);
} else {
digitalWrite(11, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment