Pages: [1]   Go Down
Author Topic: WiFi.config() - Static IP problem - RESOLVED  (Read 3444 times)
0 Members and 1 Guest are viewing this topic.
Derbyshire
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I am trying to make my arduino wifi shield gain a static ip on my network using the example:
http://arduino.cc/en/Reference/WiFiConfig

Example code:
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?

Thanks,
« Last Edit: June 23, 2013, 11:47:07 am by Wi11turner » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8667
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you got Arduino 1.0.5?

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Derbyshire
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks John,

I have installed 1.0.5 and was able to call and upload WiFi.config(ip).

Despite this it does not set a static IP, rather a dynamic one, as the next available on the network.

I will look into the firmware.

Logged

Derbyshire
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The WiFi.config() now works after:

1. Downloading and using Arduino 1.0.5.
2. Firmware updated following Arduinos instructions:
http://arduino.cc/en/Hacking/WiFiShieldFirmwareUpgrading

I found the Arduino instructions to be rather non-intuitive, especially if you are not friendly with command prompt.

Basically to upgrade the firmware on the shield you have to:
1. Upgrade HDG104 named "wifi_dnld.elf"
2. Upgrade T32UC3 named "wifiHD.elf"

I used this tutorial to help with a non command prompt update method:
http://www.dfrobot.com/community/how-to-upgrade-arduino-wifi-shield-firmware-on-windows.html

I hope this helps anyone with similar problems.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good morning

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)

Tanks a lot
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I am in a similar situation.

I am on WIndows 7, and my Arduino is 1.0.2 (downgraded from 1.0.5 to make WiFi shield work with the Arduino)

Now I cannot use some WiFiClass function, say config(),...

What should I do now? Upgrade Arduino back to 1.0.5? But I just downgraded it such that Arduino talks to WiFi shield.

Thanks a lot in advance.


The WiFi.config() now works after:

1. Downloading and using Arduino 1.0.5.
2. Firmware updated following Arduinos instructions:
http://arduino.cc/en/Hacking/WiFiShieldFirmwareUpgrading

I found the Arduino instructions to be rather non-intuitive, especially if you are not friendly with command prompt.

Basically to upgrade the firmware on the shield you have to:
1. Upgrade HDG104 named "wifi_dnld.elf"
2. Upgrade T32UC3 named "wifiHD.elf"

I used this tutorial to help with a non command prompt update method:
http://www.dfrobot.com/community/how-to-upgrade-arduino-wifi-shield-firmware-on-windows.html

I hope this helps anyone with similar problems.
Logged

Pages: [1]   Go Up
Jump to: