Hi all
Can any one trll why my code doesn’t work ;
i wont to connect ldr sensor to esp32
but it dosent work the outlight pin dosent give me low why
const int ldr =23;
const int outlight = 25;
void ldrlamp();
void setup{
pinMode(ldr, INPUT);
pinMode(outlight, OUTPUT);}
void loop() {
ldrlamp();
}
void ldrlamp(){
if(digitalRead(ldr)==1){
digitalWrite(outlight, LOW);
}else{
digitalWrite(outlight, HIGH);
}
}