Show Posts
Pages: [1] 2 3 ... 55
1  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield stops working after day on: February 13, 2014, 04:53:06 pm
Here is my client code. It has all the "antifreeze" stuff added to it, including a timeout if the connection fails.
http://playground.arduino.cc/Code/WebClient

Thank you!
2  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield stops working after day on: February 13, 2014, 04:08:28 pm
@pylon - it's a QNAP NAS box.

I checked the behavior with telnet before implementing it.
3  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield stops working after day on: February 13, 2014, 04:04:56 pm
@pylon: My past experiments have shown that if the socket has characters in the rx buffer, it will not close properly when client.stop() is called.

That should be straight forward to code in for, I'll try it. Ta.
4  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield stops working after day on: February 10, 2014, 08:45:47 am
Will do, thanks surfertim.

Is there a way round if it is lack of sockets?  Can I reset the ethernet shield in my sketch?
5  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield stops working after day on: February 10, 2014, 07:50:25 am
I thought client.stop would end the use of that socket?
Is there a way to finish with a socket?

I haven't actually debugged it (that serial print is legacy from when I was debugging during its creation), I presumed it'd be a known problem and someone would be able to tell me the answer  smiley-confuse
6  Community / Bar Sport / Re: Found today on the intertez on: February 10, 2014, 07:39:19 am
I too couldn't shut down my win8 PC without asking how.

I think it's because it's designed for devices that you never actually shut down, like tablets and laptops.  I rarely bother shutting my laptop down, I just close the lid and it goes to sleep.
7  Community / Bar Sport / Re: A broken Arduino... on: February 10, 2014, 07:27:27 am
Are you sure it's dead?

I cocked something up whilst wiring in nixies and shot 200v+ instead of 12 into a duemilanove clone:


It still works if you power it through the USB socket.
8  Using Arduino / Networking, Protocols, and Devices / Ethernet shield stops working after day on: February 10, 2014, 07:17:32 am
Hello,
I've got a project which checks whether the internal and external networks are working, and if they are gets a colour from a local web page.  It then either flashes an error code or lights RGB LEDs to the relevant colour.

This works fine, but after a day or so it error codes indicating that it doesn't have an internal or external network connection.  There's no gap between each error signal, so it's not behaving in the same way as it does when there's a real network problem as that takes a few seconds to check.  It seems that the ethernet shield just stops responding.

It's an old one - duemilanove era (circa 2011), in case that makes a difference.

Any suggestions, please?

Here's the code (I've stripped the colour change bits in order to get it to post):
Quote
#include <SPI.h>
#include <Ethernet.h>

boolean anode = false;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //MAC address
IPAddress server1(74,125,232,128);  // IP for Google for external network check
IPAddress server2(192,168,0,1);     // router for internal network check
char server3[] = "192.168.0.9";     // cownas for colour.
// RGB LED control
int redPin   = 3;   // Red LED,   connected to digital pin 3
int greenPin = 5;  // Green LED, connected to digital pin 5
int bluePin  = 6;  // Blue LED,  connected to digital pin 6

byte redV = 0;
byte greenV = 0;
byte blueV = 0;
byte oldRedV = 0;
byte oldGreenV = 0;
byte oldBlueV = 0;
String temp = "";
int RGB = 0;

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192,168,0,250);

// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

  void setup() {
  pinMode(redPin, OUTPUT);   // sets the pins as output
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);

  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Ethernet.begin(mac, ip);
  }
}

void outLight(byte rValue, byte gValue, byte bValue) {
  (sets the RGB LED)
}

void fader(byte oldrValue, byte oldgValue, byte oldbValue, byte rValue, byte gValue, byte bValue, byte pause) {
  //Fades to an RGB colour over a number of steps 
}

boolean checkNetwork() {
  //checks the status of the internal and extrarnal networks
  //flashes if broken.
  boolean internal = false;
  boolean external = false;
  
  if (client.connect(server1, 80)) {  //can't connect to google
    external = true;
  }
  client.stop();
  if (client.connect(server2, 80)) {  //can't connect to router
    internal = true;
  }
  client.stop();
  
  if ((internal == false) || (external == false)) {  //one or both failed
    return false;
  } else {
    return true;
  }
}

void loop()
{
  RGB=0;
  if (checkNetwork()) {
    if (client.connect(server3, 80)) {
      Serial.println("Connected...");
      client.println("GET /arduino/getcolour.php");
      client.println("Connection: close");
    }
    delay(100);
    while (client.available()) {
      char c = client.read();
      if (c != 44) {
        temp += c;
      } else {
        if (RGB == 0) {
          redV = temp.toInt();
          temp = "";
        } else if (RGB == 1) {
          greenV = temp.toInt();
          temp = "";
        } else if (RGB == 2) {
          blueV = temp.toInt();
          temp = "";
        }
        RGB++;
      }
    }
    fader(oldRedV,oldGreenV,oldBlueV,redV,greenV,blueV,70);
    client.stop();
    oldRedV = redV;
    oldGreenV = greenV;
    oldBlueV = blueV;
    delay(10000);
  }
}

9  Community / Bar Sport / Re: cast the line with no bytes on: January 26, 2014, 01:51:29 pm
Looks like you don't have SSL.  You need to link to the http not https.
10  Community / Bar Sport / Re: Weird or Innovative Repairs, Catastrophic Failures on: January 24, 2014, 09:17:57 am
@cr0sh re "...he probably busted the screen by picking the laptop up by it, is my best guess."

Not necessarily. I see the real reason has been posted, but I had a cheap dell whose hinges went for no apparent reason.  I know how to treat a laptop properly and that thing was cheaply made.
11  Using Arduino / General Electronics / Clock problem (DS1307) on: January 24, 2014, 05:06:25 am
I have a project with a DS1307 in it.  The time stops (but the sketch keeps running), and I'll have to run the sketch to set the time then put the relevant sketch back on.

Is this because the battery is low or is there likely to be another reason?
12  Community / Bar Sport / Re: Terabytes on: November 13, 2013, 11:49:49 am
Quote
Mp3s go at about 1MB a minute
Depends what compression is used. I use 256K bit, songs take about 8-9 Mbyte.
128K only sounds okay when listening in a car when road/tire/engine/airstream noise kills fidelity.

My first mp3 player was the original: http://www.theregister.co.uk/2008/03/10/ft_first_mp3_player/, it had 32MB onboard memory and I couldn't afford a smartmedia storage card to double it up to 64MB.

In order to get a decent range of songs on I'd downsample them to mono and a ridiculously low bitrate.  128k is a luxury!
13  Community / Bar Sport / Re: Terabytes on: October 09, 2013, 03:43:27 am
In the late 90s I worked out that a device with the capacity for a lifetime's music should be available before 2020.

Mp3s go at about 1MB a minute, so that's about 40TB.  If you filled a 40TB media player with music then you could spend your entire life constantly listening to music (including sleeping time) without repeating a track.
14  Community / Bar Sport / Re: Router recommendation on: October 09, 2013, 03:36:47 am
NetGear - WNDR3700 - N600 dual band gigabit router (note I have fibre at home)

I too have an N600 and I love it.  It's the best router I've had, and worth the money.

I switched from the VirginMedia (fibre provider) modem/hub thing to the N600 as the provided thing wouldn't sustain two VPN connections for long (my wife and I both work form home fairly regularly) and there was no network controlled family filter option.

The N600 performs well, I get 50mbps on speedtest over the 5ghz wifi (best I've ever had), it handles two VPN connections fine and uses OpenDNS for family filtering, which means that it's my whole network that's filtered.

I was skeptical about buying such an expensive router, but it's been worth the money.
15  Community / Bar Sport / Re: new laptop Win8 on: October 09, 2013, 02:46:01 am
I love win8, it's the first since xp that I've actually liked.

I like the difference between apps and programs, though a touch sensitive mouse helps as I can use gestures to switch between various things - it makes the whole interface much more useable and I don't think I'd have got on with it if I'd only had a traditional mouse.
Pages: [1] 2 3 ... 55