Show Posts
Pages: 1 ... 179 180 [181] 182 183 ... 361
2701  Using Arduino / Networking, Protocols, and Devices / Re: EthernetClient.connect() blocking issue on: January 30, 2013, 02:03:45 pm
Here is the datasheet for the w5100.
http://www.sparkfun.com/datasheets/DevTools/Arduino/W5100_Datasheet_v1_1_6.pdf
There are a couple registers you may be interested in modifying. Take a look at the bottom of page 22 and top of page 23. Registers RTR (Retry Time Register) and RCR (Retry Count Register).

Then look at the /libraries/Ethernet/utility/w5100.h file at the bottom. Those are the functions you use to change them.

I think I would start with the RCR register. According to the docs, it will attempt to connect 8 times before returning fail. Maybe you want just one attempt per call.
2702  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield + DHCP on: January 30, 2013, 06:02:11 am
Quote
Anyone tried the Ethernet shield connecting using DHCP?
Yes, and it works good!  smiley
2703  Using Arduino / Networking, Protocols, and Devices / Re: EchoServer based on ChatServer, appending strings to output on: January 29, 2013, 05:49:57 am
Glad I could help. You could do it with either print or println like this:
Code:
server.println(" +OK");
// equals
server.print(" +OK\r\n");
2704  Using Arduino / Networking, Protocols, and Devices / Re: EchoServer based on ChatServer, appending strings to output on: January 29, 2013, 05:12:00 am
Quote
I don't really understand why
Code:
      if(thisChar == '\n') server.print(" +OK");
      if(thisChar != '\r') server.print(thisChar);

puts the " +OK" after thisChar, since one comes after the other...
It only prints " +OK" if thisChar is a newline. If thisChar is anything but a carriage return, it prints the character. Actually, it probably should have been like this:
Code:
      if(thisChar == '\n') server.println(" +OK");
      else if(thisChar != '\r') server.print(thisChar);
This way it doesn't print the "\n" either.
2705  Using Arduino / Networking, Protocols, and Devices / Re: EchoServer based on ChatServer, appending strings to output on: January 29, 2013, 04:44:52 am
You should probably check for the return key also. They are normally sent as a pair.
Code:
if(thisChar == '\n') server.println(" +OK");
if(thisChar != '\r') server.print(thisChar);
This way the CR/LF is sent by the server.println() command.
2706  Using Arduino / Networking, Protocols, and Devices / Re: EchoServer based on ChatServer, appending strings to output on: January 29, 2013, 04:30:51 am
Try something like this. It waits for a newline character to print the +OK.
Code:
if(thisChar == '\n') Serial.print(" +OK");
Serial.write(thisChar);
2707  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield + DHCP on: January 29, 2013, 04:16:56 am
This works for me with w5100 and IDE v1.0.1 or later.
Code:
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

void setup() {
  Serial.begin(9600);

  // disable SD SPI if one in the slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Serial.print("Starting ethernet...");
  if(!Ethernet.begin(mac)) Serial.println("failed");
  else Serial.println(Ethernet.localIP());
}

void loop() {
}
2708  Using Arduino / Networking, Protocols, and Devices / Re: Multiple Services running on Ethernet Shield module at same time on: January 27, 2013, 08:39:57 am
why this code doesn't work?
When compiling, it makes a lot of errors! Does it work on Aduino 0022?
It will not compile with any version below IDE v1.0, and probably will not work well unless IDE v1.0.1 or higher.
2709  Using Arduino / Programming Questions / Re: "class was not declared in this scope" I could swear it was. on: January 25, 2013, 03:12:27 pm
Are you certain that is the way those files are supposed to be compiled? It looks like you must open the first file, then add the second file.

Open the file ik.ino with your IDE. Then select "Sketch/Add file". Find and add Vector3.ino. Compile.

Is that what you did?
2710  Using Arduino / Networking, Protocols, and Devices / Re: Web server not responding somtimes on: January 23, 2013, 11:58:06 am
Yopu are probably running out of SRAM. Try the F() function to keep those static strings in program memory. Here is an example. Use the same on the rest of those strings.
Code:
          client.println(F("HTTP/1.1 200 OK")); // Standard HTTP response
2711  Using Arduino / Programming Questions / Re: Problem with Ethernet Library and Led on: January 23, 2013, 11:07:31 am
I use the product schematics. D4 is used by the uSD card if there is one in the slot. D2 is used on some for an interrupt line.
2712  Using Arduino / Programming Questions / Re: Problem with Ethernet Library and Led on: January 23, 2013, 10:30:42 am
If this is an Uno, you can't use D10-13 for LEDS when using the SPI. The ethernet shield uses the SPI bus for both the w5100 and uSD. Use other pins.

2713  Using Arduino / Networking, Protocols, and Devices / Re: Controlling arduino outside of the same network? on: January 22, 2013, 06:37:18 pm
You will probably need to route the public ip on the router to the private ip of the Arduino. Then you must determine if your ISP allows port 80 requests to your ip. If you do not have a commercial account, they may block port 80 requests to your ip.

See if you can ping that ip from your sister's computer.
2714  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield cannot connect on: January 22, 2013, 08:00:34 am
Quote
Since 10.0.0.0 is the reserved Class A private subnet, I would expect your router and linux box configured themselves with the default mask 255.0.0.0 unless you actually set it to 255.255.255.0
That is not correct for the ethernet shield. If you specify just the ip, it builds the rest as a class c network. If you use 10.0.0.2 as the ip, it will use
255.255.255.0 as the subnet mask.
10.0.0.1 as the gateway and dns server.


2715  Using Arduino / Networking, Protocols, and Devices / Re: ethernet shield problem on: January 21, 2013, 07:45:28 am
what should i use instead of String?
A character array. Here is my server code. It does not use String types, and closes the connection when finished sending packets. You may also be running out of sockets. There are only 4.
http://playground.arduino.cc/Code/WebServerST
Pages: 1 ... 179 180 [181] 182 183 ... 361