Hi my program doesnt work properly - error sending message by serial port

Hi i just finish my sketch and i dont have any error but when i opened my serial port i triyed to start sending cmd of “GetTime” and console doesnt answer me. But the strange is when i tryed sending to serial visual or exam that they work…I dont know how to solve these problem, thanks.


examenpractica2.ino (36.4 KB)

We don't use Serial.readString(), that will always fail. Maybe not always, but in many situations.
You can try to send "GetTime" without Carriage Return and without Line Feed and then wait for the one second timeout.

unsigned long currenttime1 = 0;
unsigned long currenttime2 = 0;
unsigned long currenttime3 = 0;
unsigned long currenttime4 = 0;
unsigned long currenttimeA = 0;
unsigned long currenttimeB = 0;
unsigned long currenttimeC = 0;
unsigned long currenttimeD = 0;

unsigned long currenttime5 = 0;
unsigned long currenttime6 = 0;

How can you possibly need 10 variables to store now?

void serial(){
//  if (cmd=="Help") Help();

Go ahead, jump right in, assume that you KNOW what is in cmd. I'll bet a box of donuts that you are wrong.