WiFi Dropouts... a little help

Discussion about the upcoming BlackWidow (WiFi+Duemilanove).

WiFi Dropouts... a little help

Postby gwilli » Tue Mar 09, 2010 6:49 am

I'm using a streamed socket to send data to my BlackWidow, when connected to USB and printing what it receives using Serial I don't get any WiFi dropouts, however when I connect it to a mobile power source such as a Li-Ion battery or 9v battery the WiFi/Arduino doesn't seem to want to accept any more data, any attempts to connect to the socket get denied, I have to reset the BlackWidow to get it working again.

It's worth noting that the blue WiFi LED remains on even though it can't accept any connections once the socket disconnects.

The sketch is below...

Code: Select all

/**
*  This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* @author Gavin Williams <[email protected]>
* <http://www.wi-drive.co.uk>
*/

char buffer[8];
Servo steer;
Servo accelerate;

void setup()
{
       WiFi.init();
       steer.attach(3);
       steer.write(90);

       accelerate.attach(5);
       accelerate.write(90);
}

void loop()
{
   WiFi.run();
        char acceleration[4] = {buffer[0], buffer[1], buffer[2], '\0'};
        char steering[4] = {buffer[3], buffer[4], buffer[5], '\0'};

        steer.write(atoi(steering));
        accelerate.write(atoi(acceleration));

}

gwilli
 
Posts: 8
Joined: Thu Jan 21, 2010 7:08 pm
Location: London
  • Website

Re: WiFi Dropouts... a little help

Postby GregEigsti » Tue Mar 09, 2010 6:37 pm

What does the rest of the code look like? Are you keeping the socket open or closing it after each transmission (you said streamed...)?
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: WiFi Dropouts... a little help

Postby gwilli » Wed Mar 10, 2010 1:06 pm

GregEigsti wrote:What does the rest of the code look like? Are you keeping the socket open or closing it after each transmission (you said streamed...)?


I'm keeping it open... sockatapp.c currently looks like this...
Code: Select all
extern char buffer[8];

static int handle_connection(struct socket_app_state *s)
{
  PSOCK_BEGIN(&s->p);
  PSOCK_READTO(&s->p, '\n');
 
  memcpy(buffer, s->inputbuffer, 8);
  memset(s->inputbuffer, 0x00, sizeof(s->inputbuffer));
 
  PSOCK_END(&s->p);
}
gwilli
 
Posts: 8
Joined: Thu Jan 21, 2010 7:08 pm
Location: London
  • Website


Return to BlackWidow

Who is online

Users browsing this forum: No registered users and 1 guest