Arduino Night Light

30,564

21

3

Arduino Night Light
This project creates an automated night light. The lights will turn on automatically when the
room is dark, and off when the room is light.

Components Needed:

1x Arduino
1x Breadboard
3x 220 Ohm Resistors
1x 10K Ohm Resistor
3x LED's
Wires

Components can be found at http://egrobotics.com/store/
This Project uses and Arduino Board and LDR Add-on Kit

www.EGRobotics.com

Code:

void setup() {
  Serial.begin(9600);
  pinMode(3, OUTPUT); 
}
void loop() {
  int sensorValue = analogRead(A0);
  if (sensorValue < 200) { // To change the point at which the light turns on change this value.
    digitalWrite(3, HIGH);
  }
  else {
    digitalWrite(3,LOW);
}
}

Click here for more great projects.


Supplies:

Share

    Recommendations

    • Classroom Science Contest

      Classroom Science Contest
    • Party Challenge

      Party Challenge
    • Gardening Contest

      Gardening Contest

    3 Discussions

    1
    None
    TRKMHNDIS

    2 years ago

    Why did you use the 10K resistors?Can you use the different values of resistors for this circuit?Please answer me. Thanks.

    0
    None
    spock.legend

    2 years ago

    Wow this is cool :D thanks !