Created
December 4, 2021 10:42
-
-
Save labsguru/c605c135fde3091f0d739ddccf29b5d8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| int sensorPin = A2; // select the input pin for the potentiometer | |
| int ledPin = 13; // select the pin for the LED | |
| int sensorValue = 0; // variable to store the value coming from the sensor | |
| void setup() { | |
| pinMode(ledPin, OUTPUT); | |
| Serial.begin(9600); | |
| } //https://kitsguru.myshopify.com/products/photosensitive-resistor-sensor-ldr-module-for-arduino | |
| void loop() { | |
| sensorValue = analogRead(sensorPin); | |
| digitalWrite(ledPin, HIGH); | |
| delay(sensorValue); | |
| digitalWrite(ledPin, LOW); | |
| delay(sensorValue); | |
| Serial.println(sensorValue, DEC); | |
| } //CREDITS : https://steps2make.com/2017/10/arduino-photo-resistor-module-ldr-ky-018/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment