Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
int ldr = 2;
int ldrValue;
int led = 15;
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
}
void loop() {
ldrValue = digitalRead(ldr);
Serial.println(ldrValue);
if (ldrValue == LOW) {
digitalWrite(led, HIGH);
} else {
digitalWrite(led, LOW);
}
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment