Pages: [1]   Go Down
Author Topic: Wifi conect to WPA example is not working  (Read 693 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

Im using this example to connect to the WPA wifi network of my home, you can see it below:

I introduced the name, and password, but the Wifi Shield led indicanting ERROR is turned ON. Any ideas??

Thanks for the help, I'm really new at this!

This example connects to an unencrypted Wifi network.
 Then it prints the  MAC address of the Wifi shield,
 the IP address obtained, and other network details.

 Circuit:
 * WiFi shield attached
 
 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 31 May 2012
 by Tom Igoe
 */
 #include <WiFi.h>

char ssid[] = "WLAN_9DEF";     //  your network SSID (name)
char pass[] = "chevere1993";  // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's 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");
    // don't continue:
    while(true);
  }
 
 // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:   
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
   
  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
  printCurrentNet();
  printWifiData();

}

void loop() {
  // check the network connection once every 10 seconds:
  delay(10000);
  printCurrentNet();
}

void printWifiData() {
  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
    Serial.print("IP Address: ");
  Serial.println(ip);
  Serial.println(ip);
 
  // print your MAC address:
  byte mac[6]; 
  WiFi.macAddress(mac);
  Serial.print("MAC address: ");
  Serial.print(mac[5],HEX);
  Serial.print(":");
  Serial.print(mac[4],HEX);
  Serial.print(":");
  Serial.print(mac[3],HEX);
  Serial.print(":");
  Serial.print(mac[2],HEX);
  Serial.print(":");
  Serial.print(mac[1],HEX);
  Serial.print(":");
  Serial.println(mac[0],HEX);
 
}

void printCurrentNet() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print the MAC address of the router you're attached to:
  byte bssid[6];
  WiFi.BSSID(bssid);   
  Serial.print("BSSID: ");
  Serial.print(bssid[5],HEX);
  Serial.print(":");
  Serial.print(bssid[4],HEX);
  Serial.print(":");
  Serial.print(bssid[3],HEX);
  Serial.print(":");
  Serial.print(bssid[2],HEX);
  Serial.print(":");
  Serial.print(bssid[1],HEX);
  Serial.print(":");
  Serial.println(bssid[0],HEX);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi);

  // print the encryption type:
  byte encryption = WiFi.encryptionType();
  Serial.print("Encryption Type:");
  Serial.println(encryption,HEX);
  Serial.println();
}
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 152
Posts: 6181
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If your hardware is working, that would indicate:
1) you have entered the incorrect SSID or passphrase
or
2) the security type on the wireless network with that SSID is not WPA PSK.

Quote
This example connects to an unencrypted Wifi network.
The same router with the same SSID?

edit: Added PSK (Pre-Shared Key). This library does not support WPA enterprise.
And there is this in the hardware reference page. Maybe WPA is not supported?
Quote
Encryption types: WEP and WPA2 Personal
« Last Edit: November 18, 2012, 10:15:04 am by SurferTim » Logged

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

Thanks for the answer!!

Just one more question

The password is the one for example the computer ask me when I want to connect to the Wifi network or is it another one??
If this is the one i should enter, I have to enter the one that came by default or the one that I changed??


I checked and the security type is WPA-PSK


Thanksss
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 152
Posts: 6181
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Should be the same passphrase as you use with your computer.

Can you change the network security to WPA2 Personal (PSK)? WPA may not be supported by the wireless shield. I've had this problem with other wireless equipment.
Logged

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

Thanks!!

Im gonna try and change it to WPA2 if it is possible!

Thank you!
Logged

Pages: [1]   Go Up
Jump to: