Arduino project : Detect Day or night with photoresistor Sensor

Thanks for Visiting here

Print Friendly and PDF

 Arduino project : Detect Day or night with photoresistor Sensor


Arduino project 


Wiring:-

LED 

Arduino Uno 

NIGHTLED 

12 

DAYLED 

13 

PhotoR(-) 

A0 

PhotoR(+) 

5v 









Coding :- 

int light;
int bulb=13;
void setup() {
  Serial.begin(9600);
  pinMode(bulb,OUTPUT);
  pinMode(12,OUTPUT);
  // put your setup code here, to run once:

}

void loop() {
  light=analogRead(A0);
  Serial.println(light);
  
  if(light>10)
  {
    digitalWrite(bulb,HIGH);
    digitalWrite(12,LOW);
  }
  else{
    digitalWrite(bulb,LOW);
    digitalWrite(12,HIGH);
  }
  delay(200);
  // put your main code here, to run repeatedly:

}

At Last Finel Project:-

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.