Go Down

Topic: [Solved] Wifly - Networking problems. (Read 724 times) previous topic - next topic

Passive

Feb 22, 2013, 10:48 pm Last Edit: Feb 24, 2013, 04:58 pm by Passive Reason: 1
Hello,

I bought a wifly shield from sparkfun, and aim to use it post sensor information to the internet.

But the problem is getting the Wifly to connect to a network. When using SpiUartermial example from wifly library I can connect to the network by doing the following in the serial monitor:
$$$
scan
set wlan phrase mypassword
join myssid

I then check that I am connected using:

show net

And I am connected.
However when saved and reboot the information is lost. Following this guide http://www.mgisolutions.info/2012/05/arduino-wifly-shield-tutorial.html with additional settings from the data sheet http://www.sparkfun.com/datasheets/Wireless/WiFi/WiFlyGSX-um2.pdf I put the following commands through the serial monitor:
$$$
set ip dhcp 0
set ip address 192.168.1.1
set ip netmask 255.255.255.0
set wlan join 4
set wlan ssid myssid  Its a virgin media hub if that changes anything
set wlan auth 4 WAP2 auth used
set wlan chan 11
set wlan phrase mypassword
save
reboot

Then when I check connection  its not connected.

Its very frustrating as I can't move on with the project. I think I would prefer it if it didn't connect either way, then it would be less frustrating.

I have tried doing different dhcp settings, as well as copying ip/netmask/chan shown when connected through the first method.

I hope that is enough information, and I have done hours of internet trawling and can't find the solution.

johnwasser

In one case you use:
Quote
set wlan phrase mypassword

and in the other you use: 
Quote
set wlan mypassword


Could that be the problem?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Passive

#2
Feb 23, 2013, 08:57 pm Last Edit: Feb 24, 2013, 04:59 pm by Passive Reason: 1

In one case you use:
Quote
set wlan phrase mypassword

and in the other you use: 
Quote
set wlan mypassword


Could that be the problem?


Sorry that was a typo in the message, I have now edited the initial post. I have now managed to get connected to a network by changing the join option to option 1. I have also managed to mash together code to set the WiFly up in code without using the Spiuart terminal with manual inputs.

How ever I now have another problem, I can't seem to get the WiFly example for a web client to work. The code i am using is:

Code: [Select]
#include "WiFly.h"

Client client("google.com", 80);

void setup() {
 
  Serial.begin(9600);

  Serial.println("connecting...");

  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /search?q=arduino HTTP/1.0");
    client.println();
  } else {
    Serial.println("connection failed");
  }
   Serial.println("End of setup.");
 
}

void loop() {
  Serial.println("Start of void loop");
  if (client.available()) {
    char c = client.read();
    Serial.print(coffee);
  }
 
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;;)
      ;
  }
  Serial.println("End of void loop");
}


Using the serial prints I can tell that it hangs at the if (client.connect() statement. Hopefully I have provided enough information for someone to be able to shed some light on the problem. I have tried several suggestions on other web client examples and still doesn't work.

EDIT: Solved, was missing just one line that fixed it all.
WiFlyClient client;

Go Up