Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
435 B
1
Indexable
Never
int photoRPin= 0;
int lightLevel;
int led=13;
int led2=12;


void setup(){

pinMode(led,OUTPUT);
Serial.begin(9600);
lightLevel=analogRead(photoRPin);

}

void loop(){

lightLevel=analogRead(photoRPin);
Serial.println(lightLevel);
if (lightLevel<100) {
  digitalWrite(led,HIGH);
//    digitalWrite(led2,LOW);

  
 } else {
  digitalWrite(led,LOW);
//      digitalWrite(led2,HIGH);

  }
  delay(50);

}

Leave a Comment