Hello,
I have this ip address:
byte ip[] = {
10, 0, 1, 46 };
and i want to print this on my I2C display
i tried different things from the forum but nothing works.
i tried print, write, println, ( byte, 0) and so on.
this one is also not working:
lcd.print("IP adress");
delay(1000);
lcd.clear();
lcd.setCursor(0,1);
lcd.print(ip);
some one have got a tip to make this running?
You will have to print byte by byte with a for loop or a while loop.
Then cast the byte to an int, like this.
lcd.print ( int(ip[0] );
These two options:
uint8_t ipSize;
ipSize = sizeof (ip);
for ( uint8_t i = 0; i < ipSize; i++ )
{
lcd.print ( int(ip[i] );
lcd.print (".");
}
or brute force printing
lcd.print ( int(ip[0] );
lcd.print (".");
lcd.print ( int(ip[1] );
lcd.print (".");
lcd.print ( int(ip[2] );
lcd.print (".");
lcd.print ( int(ip[3] );
lcd.print (".");