int cahaya=0;
void setup() {
pinMode(A0, INPUT);
pinMode(2, OUTPUT);
}
void loop() {
cahaya = analogRead(A0);
if(cahaya > 500){
digitalWrite(2, LOW);
}
else
{
digitalWrite(2,HIGH);
}
delay(1000);
}
int cahaya=0;
void setup() {
pinMode(A0, INPUT);
pinMode(2, OUTPUT);
}
void loop() {
cahaya = analogRead(A0);
if(cahaya > 500){
digitalWrite(2, LOW);
}
else
{
digitalWrite(2,HIGH);
}
delay(1000);
}