Wifly: Alternate GPIO Functions - using Wifly as a server

Hello,

I’m curious if anyone here is trying to use their Wifly as a server, rather than as a client. Entering program mode (“$$$”) to close current connections doesn’t always work (I’ve found a few bugs in the WiFly, all software related, requiring a reboot).

I was hoping that someone has tried making a Wifly server and experimented with the alternate GPIO settings (10.5.1 in the user manual). I see GPIO5 can be set as an input, and when triggered high, the module attempts a TCP IP connection to a known server. I’m inquiring about the opposite: If I have an open connection, can I poll a pin to see if the connection is open, and drive another pin low to close the connection? This would be really convenient!

Thank you,

Tom

Hi! I’m using my WiFly as a TCP server to send data to a port on a PC on my local wireless network. During your initial setup (while in command mode) use this command

set uart mode 2

More info on this found on page 38 of the user manual.

Hope this helps!

Gary

Not quite… uart mode 2 makes the wifly connect upon receiving data from a micro. In this configuration, the wifly is being used as a client, not a server. You have your wifly connect to a host upon receiving UART data, have it send that data, and then close. In my case, the wifly is the server. Am I interpreting this wrong?

Maybe. If the WiFly is serving out the data, doesn’t that make it the server? If in your configuration you plan to send data from Arduino to WiFly, then transfer data via Wi-Fi over TCP, then what I listed above will work (I used it in a recent program I wrote).

If you plan on sending data to the WiFly from an outside source (i.e. a computer, i.e. the WiFly is a client) and have it wake on reception of the data, then what I have is not the right command for you. There are methods to have your wifly sleep for a certain period of time, then wake up, set up a TCP, receive data, and sleep after x number of seconds after no data remains. These are also listed in the manual.

Sorry if I was of no help to you…

-Gary

Thats ok! Thanks for the help. Indeed I am using the wifly in a different way that you are. It doesn’t use the same TCP connection all the time. I have it set up such that anyone in the world can access it over a browser, or using a program i wrote. Although I have it working, when accessing it with a browser, its really slow in order for it to work all the time (5 seconds to load the page, 1 second to wait after the page is loaded before interacting with the generating site). Running my program is perfectly fine though and works really fast. But its ok! So far I only having it turning on and off a light over the internet :slight_smile: I need to think of a GOOD application now.

How about something like this: http://www.teletoyland.com/Projects/Sandbox/