I have an arduino connected to my computer (COM9) and I have 3 python scripts. The first sends "1" to the serial number. The second sends "0" in sequence. The third sends the word that you give him.
ser.write("1")
Then on my arduino I have a code. If python script 1 is running, it will turn on the LED. If you run the script for 2 seconds, it will turn off the LED. If python script 3 is running, it will print the word on lcd.
All equipment is configured correctly. The problem is that when you run script 1, not only the LED turns on, but there will also be 1 on lcd. The other 2 scripts work as expected.
This is part of the code of my arduino.
if (Serial.available())
{
wordoftheday = Serial.readString();
if (wordoftheday == "1"){email = true;}
if (wordoftheday == "0"){email = false;}
else {
lcd.clear();
lcd.print(wordoftheday);
}
}
if (email == true){digitalWrite(9, HIGH);}
if (email == false){digitalWrite(9, LOW);}