B4R Code Snippet Set IP address static/fixed for ESP8266

Discussion in 'B4R Code Snippets' started by ilpesce, Feb 2, 2017.

  1. ilpesce

    ilpesce Member Licensed User

    I used the following code placed in "Sub AppStart" allows you to configure ip etc..
    tested in ESPConfigureWiFi...
    Best regards

    Code:
    RunNative( "SetIP" , Null )

    #if C
      void SetIP(B4R::Object* o) {

      IPAddress ip(192, 168, 1, xxx);  // (Replace xxx with desired IP)
      IPAddress gateway(192, 168, 1, 1);
      IPAddress subnet(255, 255, 255, 0);
      WiFi.config(ip, gateway, subnet);

      }
      
    #end if
     
    Last edited by a moderator: Mar 6, 2017
    Peter Simpson, derez and inakigarm like this.
  2. inakigarm

    inakigarm Well-Known Member Licensed User

    Peter Simpson likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    Is it still there? I've added code tags.
     
    Peter Simpson likes this.
  4. inakigarm

    inakigarm Well-Known Member Licensed User

    No, copying and pasting the snippet is fine now :)
     
  5. Chris160179

    Chris160179 Member Licensed User

    Hello everybody,

    i would like to pass an IP address direct to the Inline C "Void Sub"
    Is there a way?

    I passed an array of bytes und used (o->toULong) to convert the object but i don´t get the right IP

    Thank You
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question.
     
  7. Chris160179

    Chris160179 Member Licensed User

Loading...