Codey OnlineArduino- & ESP32-componentenbibliotheek › LDR Light Sensor Module
LDR Light Sensor Module
Sensoren

LDR Light Sensor Module

Fotosensitieve LDR-lichtsensormodule, fotoweerstands-detectieboard voor Arduino en smart home

Breedte: 39.1 mm

Pinout — LDR Light Sensor Module

Pin Signaal Beschrijving
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

Voorbeeld-aansluitschema — LDR Light Sensor Module

Van Naar Draad
board:A0 x1:S green
board:GND x1:GND black
board:5V x1:VCC red

Voorbeeld-Arduinocode — LDR Light Sensor Module

Dit voorbeeld is geschreven en compile-gecheckt voor de arduino-uno. Codey Online past het voor je aan naar elk ander ondersteund board.

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);
}

Vergelijkbare componenten

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Bouw je Arduino- of ESP32-project met AI

Beschrijf wat je wilt bouwen. Codey Online schrijft de code, tekent het aansluitschema, compileert het en flasht je board rechtstreeks vanuit de browser.

Gratis starten