Devices & Components
Arduino Uno Rev3
Breadboard (generic)
Photo resistor
LED (generic)
Software & Tools
Arduino IDE
Project description
Code
CODE FOR LDR
arduino
1void setup() { 2 Serial.begin(9600); // Start Serial. 3 pinMode(13, OUTPUT); 4} 5 6void loop() { 7 int A = analogRead(A0); 8 Serial.println(A);// Display serial results in serial monitor. 9 if (A < 100 ) { // Change 100 to the number depending on the light in your area. 10 digitalWrite(13, HIGH); 11 } 12 13 else { 14 digitalWrite(13, LOW); 15 } 16 17 18}
Downloadable files
CONNECTIONS
CONNECTIONS

CONNECTIONS
CONNECTIONS

CONNECTIONS
CONNECTIONS

Documentation
CONNECTIONS
CONNECTIONS

Comments
Only logged in users can leave comments