Using Wifi Shield WLS06201P with Mega

Ardiuno Compatible shields

Moderator: cory.j.fowler

Using Wifi Shield WLS06201P with Mega

by wsanders » Mon Mar 18, 2013 4:03 am

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 2189 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 2189 times
Last edited by wsanders on Mon Mar 18, 2013 4:16 am, edited 1 time in total.
Pre-kindergarten
Pre-kindergarten
 
Posts: 14
Joined: Thu Feb 21, 2013 5:44 am

Re: Using Wifi Shield WLS06201P with Mega

by yexiaobo » Wed Mar 20, 2013 2:15 pm

Hi,wsanders.

We already have a new library(and demo) for Wifly. It will be release coming soon.
Pre-kindergarten
Pre-kindergarten
 
Posts: 47
Joined: Tue Dec 11, 2012 10:53 am

Re: Using Wifi Shield WLS06201P with Mega

by wsanders » Thu Mar 21, 2013 1:24 am

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.
Pre-kindergarten
Pre-kindergarten
 
Posts: 14
Joined: Thu Feb 21, 2013 5:44 am

Re: Using Wifi Shield WLS06201P with Mega

by rubensmau » Thu Mar 21, 2013 5:08 pm

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
Pre-kindergarten
Pre-kindergarten
 
Posts: 2
Joined: Mon Mar 18, 2013 3:28 pm

Re: Using Wifi Shield WLS06201P with Mega

by andrers420 » Tue Apr 30, 2013 1:58 am

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.
Pre-kindergarten
Pre-kindergarten
 
Posts: 2
Joined: Tue Apr 30, 2013 1:40 am


Who is online
Users browsing this forum: No registered users and 0 guests