I am trying to make my arduino wifi shield gain a static ip on my network using the example:
Example code:
#include <SPI.h>
#include <WiFi.h>
// the IP address for the shield:
IPAddress ip(192, 168, 0, 177);
char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS;
void setup()
{
// Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
while(true); // don't continue
}
WiFi.config(ip);
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
// print your WiFi shield's IP address:
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
}
void loop () {}
When I do this, I have the error of:
'class WifiClass' has no member named 'config'
I have updated the wifi library, there is probably something simple I am doing wrong but I have read some discrepancy in the capabilities of the static IP feature of the arduino wifi board.
Does anyone know why I am getting this error?
Has anyone had any experience in doing this?
Note: Someone recently posted that, although they were able to call WiFi.config(ip), it did not set a static IP address. They had to update the firmware on the WiFi Shield to get it to work. You may run into that same problem once you get the WiFi.config() call to be recognized.
I have read your post, and I want to ask you some question on my project.
I want to implement a sketch to interface Wifi shield with my tablet (I have ad Android o.s.). I think to use the WiFi library (it's the best documented that I have found).
I have read about some problem on compatibilty between the Shield and library, so please I ask you suggestion to the kind and version I have to use to avoid the problem:
Wifi Shield
Wifi library
IDE version (I think it's the 1.0.5, but I'm not sure)