PLS HELPPP YL-99 can't respond HIGH/LOW on the serial monitor

actually, i'm doing a project about water sensor, l298n, dc motor and yl-99 swtich. btw i don't know what's it going. i checked every sensors that are okay without the yl-99 switch. yl-99 can't respond on the serial monitor. Please HELP.`

#define watersensor A0
#define in1 D1
#define in2 D2
#define switch1 D3
#define switch2 D4
#define eva D0

int val = 0 ;
void setup () {
Serial.begin(9600);
pinMode(watersensor, INPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(switch1, INPUT);
pinMode(switch2, INPUT);

}

void loop() {
val = analogRead(watersensor);
Serial.println(val);
delay(200);

if (val > 5)
{
while (digitalRead(switch1) == LOW)
{ digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
}
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
}
else
{
while (digitalRead(switch2) == LOW)
{ digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
}
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
}

delay(500);

}`

this is my code tho.
and this happen on my serial monitor

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

Which Arduino board are you using ?

i'm using esp8266 tho

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.