hello, I just changed to platformio, and i dont get how i can interact through the serial monitor. I want to test functions by calling them, but i cant find the input windows. I know there are other threads on this topics but i dont get it.
void loop() {
if (Serial.available() > 0) {
String command = Serial.readString();
if (command == "sleep") {
sleepCell();
Serial.println("Cell is sleeping");
} else if (command == "start") {
startCell();
Serial.println("Cell started");
}
}
Please note that the new line character (\n = Ascii Code 10) is also read in with ReadString()!
You will therefore not only receive “start” but “start[\n]” (Ascii codes: 115,116,97,114,116 and 10 for the new-line character)
By default, PlatformIO’s serial monitor sends the characters over serial as soon as you type each letter. If your program is written to expect the serial input “all at once” without much delay, then you can just configure the serial monitor to only send something when you press enter.
Thanks for the reply, but i´m allreay struggling one step ahead, where can i input my string in the first place? I guess its normaly obvious, but i just cant find it. In the arduino ide, there is a input field above the sm.