Skip to content

Instantly share code, notes, and snippets.

@mrichardson23
Created June 5, 2013 16:37
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 mrichardson23/5715325 to your computer and use it in GitHub Desktop.
Save mrichardson23/5715325 to your computer and use it in GitHub Desktop.
#define LED_PIN 13
#define BUTTON_PIN 2
#define DIM_LED 11
void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(DIM_LED, OUTPUT);
pinMode(BUTTON_PIN, INPUT);
}
void loop() {
if (digitalRead(BUTTON_PIN) == HIGH) {
analogWrite(DIM_LED, 50);
}
else {
analogWrite(DIM_LED, 255);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment