Created
January 23, 2016 22:26
-
-
Save tarunbod/26c5654251d24950e6e7 to your computer and use it in GitHub Desktop.
Arduino - Turn on LED based on Photoresistor value
This file contains hidden or 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
void setup() { | |
pinMode(13, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
int lightLevel = analogRead(0); | |
if (lightLevel < 150) { | |
digitalWrite(13, HIGH); | |
} else { | |
digitalWrite(13, LOW); | |
} | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment