Appendix A (LDR Circuit Components)
Appendix A (LDR Circuit Components)
Arduino Uno
Coding
:
PIR SENSOR
PIR SENSOR
SB 0061
PIR
MOTION
SENSOR
CIRCUIT
PIR
MOTION
SENSOR
CIRCUIT
int LDRValue = 0;
void setup()
{
Serial.begin(9600);
//start the serial monitor with 9600 buad
pinMode(13, OUTPUT); //we mostly use 13 because there is already a built in yellow LED in
arduino which shows output when 13 pin is enabled
}
void loop()
{
LDRValue = analogRead(LDR);
Serial.println(LDRValue);
//prints the LDR values to serial monitor
delay(50);
//This is the speed by which LDR sends value to arduino
if (LDRValue < light_sensitivity)
{
digitalWrite(13, HIGH);
}
else
{
digitalWrite(13, LOW);
}