arduino wifi ip address to string code example

Example 1: arduino ip to string

//IP addresses are stored as an array, you can just say

IPAddress my_IPAddress(162.198.2.3);
Serial.println(my_IPAddress[1]);

//Output
--------------------------------------------------------
 > 198

Example 2: arduino wifi ip address to string

String IpAddressToString(const IPAddress& ipAddress) {
  return String(ipAddress[0]) + String(".") +\
  String(ipAddress[1]) + String(".") +\
  String(ipAddress[2]) + String(".") +\
  String(ipAddress[3])  ;
}

Tags:

C Example