Page 1 of 1

Using Wifi Shield WLS06201P with Mega

PostPosted: Mon Mar 18, 2013 4:03 am
by wsanders
I have the Wifi Shield WLS06201P connected to my Mega:
Code: Select all
Remove the header jumpers from the TX/RX pins
Jumper WIFI_TX  to Mage Pin 10 (black wire in photo)
Jumper WIFI_RX to Mega Pin 11 (yellow wirein photo)
Alter the definition of WiFly class for pins 10,11: WiflyClass Wifly(10,11);

pingable.jpg
pingable.jpg (214.34 KiB) Viewed 2491 times

What this does is allow the shield's library, which uses the SoftwareSerial class, to communicate with the Mega using pins 10 and 11. The Mega doesn't support SoftwareSerial on pins 0-7: "Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69"

The WiFly device is now pingable. I have some garbage in my serial port monitor, but those characters are the "connection refused" TCPIP packet returned from the computer I am connecting to. Now I can get to work on a communication protocol between the Mega and other computers.
Screen Shot 2013-03-17 at 12.35.10 PM.png
Screen Shot 2013-03-17 at 12.35.10 PM.png (130.35 KiB) Viewed 2491 times

Re: Using Wifi Shield WLS06201P with Mega

PostPosted: Wed Mar 20, 2013 2:15 pm
by yexiaobo
Hi,wsanders.

We already have a new library(and demo) for Wifly. It will be release coming soon.

Re: Using Wifi Shield WLS06201P with Mega

PostPosted: Thu Mar 21, 2013 1:24 am
by wsanders
Hey thanks,

I am also thinking of rewriting the library for Serial1,2,3 etc for the Mega, if I have time. I'll post a link here if I get around to that.

The RN-171 is a great choice for a module, it has a lot of interesting capabilities.

Re: Using Wifi Shield WLS06201P with Mega

PostPosted: Thu Mar 21, 2013 5:08 pm
by rubensmau
Thanks wsanders for your detailed description - it worked fine for me.

Please notice that the following library is available and works for your configuration:

WiFlyHQ - available in github ( the board did not allow me to post the URL )

Cheers

Re: Using Wifi Shield WLS06201P with Mega

PostPosted: Tue Apr 30, 2013 1:58 am
by andrers420
Hi i posted this in other topic, but then i tought maybe if i posted here it would be more appropriate, so here it goes.
Im using mega 2560 with the RN-171, the very same in the picture posted in by wsanders.
I get messy characters on console and i dont think im connecting because both D1 and D5 are still blinking.
Im using the softwareserial library and the WiflyHQ-master i saw here, still i can't understand why it doesn't work.

here is my code:

#include "Wifly.h"
#include <SoftwareSerial.h>
WiflyClass Wifly(10,11);

void setup()
{
Serial.begin(9600);
Wifly.init();
Serial.println("init");
Wifly.setConfig("SSID","phrase");
Serial.println("SetConfig");
Wifly.join("phrase");
Serial.println("Join");
Wifly.checkAssociated();
Serial.println("checkAssociated");
while(!Wifly.connect("192.168.1.1","8080"))Serial.println("trying");
Wifly.writeToSocket("Connected!");
}
void loop()
{
if(Wifly.canReadFromSocket())
{
Wifly.readFromSocket();
}
if(Serial.available())
{
Wifly.print((char)Serial.read());
}
}
Any ideas are welcome.