I am trying to either set a static IP or have the device set a name. I can’t get either to work on a UNO R4 WiFI board. I see a sort of work around for the Giga board, Is there a Fix for the UNO R4 WiFi board? All the libraries and the firmware have been updated. I have tried many variations calling the config() method. The code is:
if (WiFi.status() == WL_NO_MODULE) { Serial.println("Communication with WiFi module failed!"); // don't continue while (true); } String fv = WiFi.firmwareVersion(); if (fv < WIFI_FIRMWARE_LATEST_VERSION) { Serial.println("Please upgrade the firmware"); } IPAddress ip("192,168,5,230"); IPAddress gateway("192,168,5,1"); IPAddress subnet("255,255,255,0"); IPAddress DNS("192,168,5,1"); // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); WiFi.config(ip,DNS,gateway,subnet); WiFi.setHostname("heatsrvr"); status = WiFi.begin(ssid, pass); // wait 10 seconds for connection: delay(10000); }
It seems that the comma format does not work although it was in some examples. I changed it to . delimited and the static ip worked. It still does not honor the WiFi.setHostname("heatsrvr"); call. Is there something else that needs to be done to get the name to work?
On the question of posting the code, I was not able to find any guide lines on the forum but I did find something in Google. I had selected the code then clicked on the option. It changed the background and removed all indenting. Apparently that was the wrong order for pasting the code.
As for <CODE/>: yeah if you're using the rich text editor, default for new users, applying that to existing text does not create a code block; it only styles the selected text, line by line. Clicking it first should create an empty block, with a language picker in the top right. After the default empty choice (which is approximately "Arduino"), the first two choices are bash and cpp