Activity E4 — Wiring an LDR

Level 1 — Connect an LDR to the Arduino

Complete the challenge

void setup() {
    pinMode(13, OUTPUT);
}

void loop() {
    if (analogRead(A5) > 100) {
        digitalWrite(13, HIGH);
    } else {
        digitalWrite(13, LOW);
}
Connecting an LDR to an Arduino Connecting an LDR to an Arduino

Claim your achievement