Arduino things detector using LDR
put this in arduino ide
Connect as per the video
int sensorPin = A0;
int LedPin = 13;
int sensorValue = 0;
void setup() {
// put your setup code here, to run once:
pinMode(LedPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
sensorValue = analogRead(sensorPin);
if(sensorValue>100)
{
digitalWrite(LedPin,HIGH);
}
else
{
digitalWrite(LedPin,LOW);
}
Serial.println(sensorValue);
}
Comments
Post a Comment