hi, im having troubles regarding the serial monitor cause it shows infinite outputs of high and low
i have this simple code:
int forwardPin = 12;
void setup()
{
Serial.begin(9600);
pinMode(forwardPin, INPUT);
}
void loop()
{
int forwardState = digitalRead(forwardPin);
if (forwardState == HIGH)
{
Serial.println("HIGH");
delay(1000);
}
else
{
Serial.println("LOW");
delay(1000);
}
}
but when i look at the serial monitor for its output, it shows infinite loops of high and low.
i also tried it for outputing Serial.write for my project, but still it doesn't work
hope u could help me. im trying this code for my robotics project so im glad if anyone here could help
thanks in advance