Created
June 5, 2013 16:37
-
-
Save mrichardson23/5715325 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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