how to Serial.print() from a function wihtin a function within a function....

Hello,

It's a code related issue, not hardware. Thus, I think even without an Arduino mkr gsm 1400, you might find out why.
Please download both my Screenshot to understand my problem (1 picture = 1000 words) and my source code (for your root-cause analyse)

Please focus on the main loop, their is 2 functions. 1 runs perfectly, the 2nd not. They do not provide same Serial.println().

Here are my workaround hypothesis:

  1. Related to "a function call a function, which call another function"
  2. Function type "void"
  3. not proper usage of Serial.println().

Attachements:

a) Screenshot with overview comment regarding my problem
b) Full Source code

Here is the excrept of the main loop.

/*******
 * Loop
 *******/
void loop() {
  //FORUM COMMUNITY PLEASE MAKE THE menuManager() WORKING
  doFullGsmGprsConnectionTest();  // HERE THE VARIABLE String oktext = "OK" ARE SUCCESSFULLY SHOWN
  menuManager();                  // HERE THE VARIABLE String oktext = "OK" ARE FAILING TO SHOW UP, PLEASE HELP ME TO MAKE IT WORK, THANKY YOU
}

Thank you for your supportive behaving.

TestGPRS_connect_to_distant_server.ino (14.4 KB)

If you look at this

char menuManagerId[1];

you have room for 1 char. When you call readSerial(menuManagerId) you are stuffing "1\0" into it which means you are writing out of bounds. You are probably doing this elsewhere as well (I didn't look) which means you are probably writing over your okText memory.

Don't forget to allocate an extra byte for the zero terminator of a C-string (character array).

Well done blh64.

You solved this problem:

blh64:
If you look at this

char menuManagerId[1];

you have room for 1 char. When you call readSerial(menuManagerId) you are stuffing "1\0" into it which means you are writing out of bounds. You are probably doing this elsewhere as well (I didn't look) which means you are probably writing over your okText memory.

thanks jremington for the details.

These are my modifications :

char menuId[2];                         // Menu ID to modify the connection settings
char menuManagerId[2];             // Menu Manager Id

now it's working fine.