Last active
August 4, 2017 16:34
-
-
Save iotguider/dace28e62286bfbd5c758ed52b691aad to your computer and use it in GitHub Desktop.
Code for Interfacing LDR in Arduino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define LDR A0 //Initialize LDR sensor pin. | |
void setup() { | |
//Begin the Serial Monitor at 9600 Baud | |
Serial.begin(9600); | |
} | |
void loop() { | |
int value = analogRead(LDR); //Store sensor value to variable | |
Serial.println(value); //Print the value to serial | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment