Wednesday 6 January 2016

Interfacing Photo Resistor With Arduino

Demonstrating Analog Input and Digital Output Using a photo Resistor and LED

Circuit:
Analog Input From Photo Resistor is Connected to A0 pin
LED is Connected to digitalPin 7


Sketch :

void setup(){
pinMode(A0,INPUT);
pinMode(7,OUTPUT);
}

void loop(){
if(analogRead(A0) < 100)
{
digitalWrite(7,HIGH);
}
digitalWrite(7,LOW);
}


Output :

No comments:

Post a Comment