Skip to content

Instantly share code, notes, and snippets.

@IsmailSan
Created September 24, 2019 10:47
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 IsmailSan/349f0a97eecf094f9e4c08245eb00863 to your computer and use it in GitHub Desktop.
Save IsmailSan/349f0a97eecf094f9e4c08245eb00863 to your computer and use it in GitHub Desktop.
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