

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Experiment No. 4 Aim: To design an automatic night lamp using LDR. Apparatus: ARDUINO, LDR, Resistance 10k ohm, wires, Breadboard Theory: IT senses the light intensity from surroundings and find whether its day or night. Programming: void setup() { Serial.begin (9600); pinMode(7,OUTPUT); } void loop() { int c = analogRead(A0); Serial.println(c); If (c<850) { digitalWrite(7,LOW); } else { digitalWrite(7,HIGH); } } CIRCUIT ON TINKERCAD
void setup() { Serial.begin (9600); pinMode(7,OUTPUT); } void loop() { int c = analogRead(A0); Serial.println(c); if (c<=800) { digitalWrite(7,LOW); } else { digitalWrite(7,HIGH); } } Result Designing of automatic night lamp was verified after uploading the program.