Serial.print() didn't work same as usually

  lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("WELCOME to F-mod");
        Serial.begin(9600);
        Max_tim = read2BytesIntFromEePROM(10) ;
        Serial.print("Max. Time interval: ") ;
        Serial.println(Max_tim) ;
        Min_tim = read2BytesIntFromEePROM(8) ;
        Serial.print("Min. Time interval: ") ;
        Serial.println(Min_tim) ;
        Max_humi = read2BytesIntFromEePROM(6) ;
        Serial.print("Max-Humidity: ") ;
        Serial.println(Max_humi) ;
        Min_humi = read2BytesIntFromEePROM(4) ;
        Serial.print("Min. Humidity: ") ;
        Serial.println(Min_humi);
        Max_temp = read2BytesIntFromEePROM(2) ;
        Serial.print("Max. Temperature: ") ;
        Serial.println(Max_temp) ;
        Min_temp = read2BytesIntFromEePROM(0) ; // read Factory parameter: address 0 for 2 byte is minimum temperature
        Serial.print("Min. Temperature: ") ;
        Serial.println(Min_temp) ;

Here are the outcome````
18:31:55.849 -> Max. Time interval: 1200
18:31:55.849 -> Min. Time interval: 230
18:31:55.894 -> Max-Humidity: 8500
18:31:55.941 -> Min.⸮⸮
Why Serial.print("Max-Humidity: ") ; print 18:31:55.941 -> Min.⸮⸮
and the next code didn't execute anymore.

Most likely something later on in the code is causing the Arduino to lock up. At 9600 baud, what you are seeing in the serial monitor is lagging behind where in the code the Arduino actually is by a considerable amount.

Don’t post snippets (Snippets R Us!)

Why string "Max-Humidity:" didn't print correctly and the sketch stop executing the next sketch line.

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Please post your full sketch

Help us help you.

.................................................................

Because the value retrieved from the eeprom is poo, is my guess.

Don’t double post please

Post merged

Unlikely. The code will be well beyond that point by the time the problem occurs. Putting Serial.flush() after every print will show what was printed last, but the actual problem is somewhere beyond that. Likely exceeding the bounds of an array somewhere, that is a common cause of something like this.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.