Read a light-dependent resistor on A0 and print the raw ADC value once a second.
From the unit VCE Systems Engineering Unit 1 — Electrotechnological systems design
· activity PRP 3: Light sensing with an LDR
// PRP 3 — light sensing with an LDR.
// Wire the LDR and a fixed resistor as a divider, junction to A0.
const int LDR_PIN = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int reading = analogRead(LDR_PIN); // 0-1023, NOT a light level yet
Serial.println(reading);
delay(1000);
}
Shared from Little Bird Electronics curriculum.