0% found this document useful (0 votes)
12 views1 page

Arduino Straight Light Control With IR Sensor

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Arduino Straight Light Control With IR Sensor

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

//Arduino ir sensor street light program with smoke sensor, Create by Swapnil Lawand 14 july

2022
const int ledPin = 10;
const int ldrPin = A0;
void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); pinMode(ldrPin, INPUT);
pinMode(5,INPUT);
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(8,INPUT);
pinMode(9,OUTPUT);
}
void loop()
{ int ldrStatus = analogRead(ldrPin);
if ((ldrStatus<1)&&(ldrStatus>25)) { digitalWrite(ledPin, HIGH); Serial.print("Its DARK, Turn on
the LED : "); Serial.println(ldrStatus); }
else { digitalWrite(ledPin, LOW); Serial.print("Its BRIGHT, Turn off the LED : ");
Serial.println(ldrStatus); }
if(digitalRead(5)==LOW){ digitalWrite(12,HIGH); }
if(digitalRead(2)==LOW)
{digitalWrite(12,LOW);}
if(digitalRead(3)==LOW){ digitalWrite(11,HIGH); }
if(digitalRead(4)==LOW)
{digitalWrite(11,LOW);}
if(digitalRead(8)==HIGH){ digitalWrite(9,HIGH); }
else digitalWrite(9,LOW);
}

You might also like