Fotosensitives LDR-Lichtsensormodul, Fotowiderstands-Erkennungsboard für Arduino und Smart Home
| Pin | Signal | Beschreibung |
|---|---|---|
S |
analog | Analog light sensor output voltage from the LDR divider to a microcontroller input |
GND |
ground | Ground reference for the LDR sensor module and connected controller |
VCC |
power | Positive supply input for the LDR sensor module, typically 3.3V or 5V |
| Von | Nach | Kabel |
|---|---|---|
board:A0 |
x1:S |
green |
board:GND |
x1:GND |
black |
board:5V |
x1:VCC |
red |
Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.
const int sensorPin = A0;
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
Serial.println("LDR Light Sensor Module example");
}
void loop() {
int raw = analogRead(sensorPin);
float voltage = raw * (5.0 / 1023.0);
Serial.print("Raw: ");
Serial.print(raw);
Serial.print("\tVoltage: ");
Serial.print(voltage, 2);
Serial.println(" V");
delay(500);
}
Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.
Kostenlos starten