Pages: [1]   Go Down
Author Topic: WiFly Shield not connecting to 3G Wifi card  (Read 460 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All,

I am using the WiFly shield and am wanting to connect it to my 3G Wifi Card from Verizon.  I can connect using my personal laptop by simply entering the ssid and the passphrase off the back of my wifi card.  When I enter those same credentials into the credentials file, the WiFly shield has trouble connecting.  Anybody have any suggestions?

My code:

  WiFly.begin();
 
    if (!WiFly.join(ssid, passphrase))
    {
      Serial.println("Connection Failed!");
      while(1)
       {
         Serial.println("Hang on Failure");
          // Hang on failure.
       }
    }
   
  Serial.print("IP: ");
  Serial.println(WiFly.ip());


Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 25
Posts: 1872
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Two ideas,

First use code tags to post your code thats the #.

Second post all your code!.

Mark
Logged

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

Code:
#include "WiFly.h"          // WiFly Library
#include "Credentials.h"    // Credentials File for Wifi

Server server (80);

WiFly.begin();
 
    if (!WiFly.join(ssid, passphrase))
    {
      Serial.println("Connection Failed!");
      while(1)
       {
         Serial.println("Hang on Failure");
          // Hang on failure.
       }
    }
   
  Serial.print("IP: ");
  Serial.println(WiFly.ip());

Logged

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

Here is what my crendentials.h file looks like:

Code:
#ifndef __CREDENTIALS_H__
#define __CREDENTIALS_H__

// Wifi parameters


char passphrase[] = "2684354591156*****";
char ssid[] = "Verizon AC30 ****";

#endif

last numbers were stared for privacy
Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 25
Posts: 1872
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try's again

Post ALL your code!. Eg setup(), loop() etc. main() if your not using the IDE.

Mark
Logged

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

Code:
#include "WiFly.h"          // WiFly Library
#include "Credentials.h"    // Credentials File for Wifi

Server server (80);

void setup()
{
WiFly.begin();
 
    if (!WiFly.join(ssid, passphrase))
    {
      Serial.println("Connection Failed!");
      while(1)
       {
         Serial.println("Hang on Failure");
          // Hang on failure.
       }
    }
   
  Serial.print("IP: ");
  Serial.println(WiFly.ip());
}

void loop()
{
Client client = server.available();
 
  if (client)
  {
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected())
    {
      if (client.available())
      {
        char c = client.read();
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (c == '\n' && current_line_is_blank)
        {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
 
          //Print data to webpage
          client.print("<meta http-equiv=\"refresh\" content=\"30\">"); //refresh every 10 seconds
          client.println("<title>The Plant Nanny</title>");
          client.println("<h1>The Plant Nanny: Plant Monitoring System</h1>");
          client.println("<h2>My Plant Data:</h2>");
          client.print("<p>Temperature is ");
          client.print(temp_erature);
          client.print("&deg");  //insert degree symbol
          client.print("F</p>");
          client.print("<p>Humidity is ");
          client.print(average);
          client.print(" % RH</p>");
          client.print("<p>Soil Moisture is ");
          client.print(vwc);
          client.print("%</p>");
          client.print("<p>Sun Light is ");
          client.print(sun_average);
          client.print(" Lux</p>");
          client.print("</div>");
          break;
        }
        if (c == '\n')
        {
          // we're starting a new line
          current_line_is_blank = true;
        }
        else if (c != '\r')
        {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }
      }
    }
   
    delay(1);  // give the web browser time to receive the data
   
    client.stop();
  }
}

Logged

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

My goal update a page (IP Address on the network) with some values.  I would put the rest of the code up there but it is literally about 4200 lines of code.  I don't think anybody wants to sift through that to help so I have dumbed it down (the wifi part at least).
Logged

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

Thanks in advance for any help you may provide!
Logged

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

I added some code to check where the connection gets stuck and it looks like it reaches WiFly.begin() but then gets stuck.
Logged

Pages: [1]   Go Up
Jump to: