Created
January 27, 2016 18:43
-
-
Save zach-c-d/64ce17b2331cabd15d03 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
//blink LED at rate specified by analog input from light resistor | |
int light_resistor = 0; | |
int LED = 13; | |
int i = 0; //level of resistance from light_resistor | |
void setup() { | |
Serial.begin(9600); //begin serial communication | |
pinMode(light_resistor, INPUT); | |
pinMode(LED, OUTPUT); | |
} | |
void loop() { | |
Serial.println(analogRead(light_resistor)); //print light_resistor | |
//value to serial | |
i = analogRead(light_resistor); | |
digitalWrite(LED, LOW); | |
delay(i/2); | |
digitalWrite(LED, LOW); | |
delay(i/2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment