Hi, I am unable to print to serial console from a subroutine.
Is it possible ?
here is an example:
This program starts the serial console and listens for commands.
commands are:
reboot (reboots ESP32)
testl (prints a line from loop() )
tests (prints a line for subroutine)
Simulator:
here is the test code:
void TestPrintln(){
Serial.println("Test from subroutine success.");
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Boot started.");
Serial.println("----------------");
}
void loop() {
//Check commands over serial
if (Serial.available())
{
String command = Serial.readStringUntil(10);
if (command == "reboot"){ESP.restart();}
else if (command == "testl") {Serial.println("Test from loop success.");}
else if (command == "tests") {TestPrintln;}
}
}