Search code examples
c++arduino

Convert IP address from String to IPAddress (Arduino)


I have an IP address that I receive as String (192,168,1,1) and I would like to put it in an object of type IPAddress. How do I do this conversion?


Solution

  • Arduino core class IPAddress has method fromString.

    Example:

    String s = "192.168.1.55";
    IPAddress ip;
    
    ip.fromString(s);
    Serial.println(ip);