-->
Page 1 of 1

Extra characters when using lcd.print

PostPosted: Mon Jul 25, 2016 12:28 pm
by rudy
At startup I have some values written to an lcd connected to the ESP8266 via I2C. I print the WiFi.hostname() on the first line, a second counter (in loop()) on the second half of the first line. I print "IP:", and then the ip address on the second line. On the third line I wrote the ip address in HEX. (the order is reversed for some reason). On the fourth line I print ESP.getFlashChipRealSize().

With the counter and the "IP:" write I get exactly what I expect. But when I have the rest of the information printed(with function calls) I end up with a couple of extra characters at the end. When I use Serial.print() these characters do not appear on the serial terminal. (as expected)

What is going on here? I would think that how I performed the operation is valid.

Image

Code: Select all  lcd.setCursor(0, 1);
  lcd.print("IP: ");
  lcd.setCursor(3, 1); 
  lcd.println(WiFi.localIP());
 
  lcd.setCursor(0, 0);
  lcd.println(WiFi.hostname());

  Serial.println(WiFi.localIP(),HEX);
  lcd.setCursor(0, 2);
  lcd.println(WiFi.localIP(),HEX); 
 
  lcd.setCursor(0, 3);
  lcd.println(ESP.getFlashChipRealSize()); 


Re: Extra characters when using lcd.print

PostPosted: Mon Jul 25, 2016 12:46 pm
by martinayotte
That is completely normal since the difference between print() and println() is that last one send also CR+LF, but those CR_LF characters are mapped to those 2 graphics in the LCD fonts.
So, simply use print() and forget about using println()

Re: Extra characters when using lcd.print

PostPosted: Mon Jul 25, 2016 12:55 pm
by rudy
I just found that myself. Man is that a dumb mistake. I should know better. :oops: