-->
Page 1 of 2

Can you pass variables to MDNS?

PostPosted: Sat Feb 06, 2016 8:17 pm
by marklein
I'd like to allow the user of my device to store a custom name for the device to use on MDNS, but it doesn't compile if I try to use MDNS.begin(x); Is this simply not supported?

Re: Can you pass variables to MDNS?

PostPosted: Sat Feb 06, 2016 9:40 pm
by martinayotte
You should provide more details about your sketch and the errors you've faced ...

Re: Can you pass variables to MDNS?

PostPosted: Sun Feb 07, 2016 5:51 pm
by marklein
Sure...

Code: Select allString XX = "TheThing";
  if (MDNS.begin(XX)) {
    Serial.println("MDNS responder started");
  }


On compile returns "no matching function for call to 'MDNSResponder::begin(String&)'"

Re: Can you pass variables to MDNS?

PostPosted: Sun Feb 07, 2016 6:16 pm
by schufti
if you look at the examples, it is used like this
Code: Select all  if (!MDNS.begin("esp8266")) {
    Serial.println("Error setting up MDNS responder!");
    while(1) {
      delay(1000);
    }
  }
  Serial.println("mDNS responder started");