Thursday 7 June 2018

LDR Sensor Module Interface With Arduino by Arsal Arduino

 LDR Sensor Module Interface With Arduino by Arsal Arduino

LDR sensor module is used to detect the intensity of light. It is associated with both analog output pin and digital output pin labelled as AO and DO respectively on the board. When there is light, the resistance of LDR will become low according to the intensity of light. The greater the intensity of light, the lower the resistance of LDR. The sensor has a potentiometer knob that can be adjusted to change the sensitivity of LDR towards light.
Specification:
  • Input Voltage: DC 3.3V to 5V
  • Output: Analog and Digital
  • Sensitivity adjustable

Code of the project:


const int ldr_pin = 7;

const int led_pin = 13;
void setup() {
  // put your setup code here, to run once:
    pinMode(ldr_pin,INPUT);
    pinMode(led_pin,OUTPUT);
    Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
   if( digitalRead( ldr_pin ) == 1){
      digitalWrite( led_pin,HIGH);
   }
   else{
      digitalWrite( led_pin , LOW);
   }
   
   Serial.println( digitalRead( ldr_pin ));
   delay(100);
}

The Link of the video:

1 comment:

Anonymous said...

Do the new be the change

Popular Posts