Go Down

Topic: WiFly Shield not connecting to 3G Wifi card (Read 665 times) previous topic - next topic

kdwalton

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());



holmes4

Two ideas,

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

Second post all your code!.

Mark

kdwalton

Code: [Select]

#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());



kdwalton

Here is what my crendentials.h file looks like:

Code: [Select]

#ifndef __CREDENTIALS_H__
#define __CREDENTIALS_H__

// Wifi parameters


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

#endif


last numbers were stared for privacy

holmes4

Try's again

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

Mark

kdwalton

Code: [Select]

#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();
  }
}



kdwalton

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

kdwalton

Thanks in advance for any help you may provide!

kdwalton

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

Go Up