Arduino

techouse

Learn More About Arduino

 

Arduino is an open-source electronics platform based on easy-to-use hardware and software.

Light Sensitivty Arduino Code

int PHOTORESISTOR=A1;
int LED=3;
void setup() {
// put your setup code here, to run once:
pinMode(PHOTORESISTOR,INPUT);
pinMode(LED,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int data=analogRead(PHOTORESISTOR);
if(data>1022)
{
digitalWrite(LED,HIGH);
}
else
{
digitalWrite(LED,LOW);
}
delay(400);
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.