Show Posts
Pages: 1 ... 186 187 [188] 189 190 ... 409
2806  Using Arduino / Programming Questions / Re: Using two ip addresses on: April 23, 2013, 08:27:42 am
You are only sending the request to one server, and that is not the appropriate code for a repeating request/response sequence. Use this to get one server working good, then I will show you how to modify that to use the two servers and different ports.
2807  Using Arduino / Storage / Re: Sdfat+w5100+Cosm on: April 23, 2013, 08:17:09 am
OK. That should be plenty of SRAM. I would check the state of the w5100 slave select pin after any calls to the cosm library. That is one of the few things that can cause problems between the devices.

if(digitalRead(10) == LOW) {
  Serial.println(F("W5100 SPI active. Disabling"));
  digitalWrite(10, HIGH);
See if it is leaving the w5100 slave select active (LOW).
2808  Using Arduino / Programming Questions / Re: Using two ip addresses on: April 23, 2013, 08:11:20 am
PaulS is correct. That code won't compile. You should post it all.
2809  Using Arduino / Interfacing w/ Software on the Computer / Re: Connect Ethernet Shield with Computer on: April 23, 2013, 08:00:36 am
This should do it. Pretend the Arduino is the "other wired computer".
"Sharing wireless connection over etherent" is the part that you should read. It appears by the comments left there, it may have some challenges with certain versions of OSX.

2810  Using Arduino / Programming Questions / Re: Using two ip addresses on: April 23, 2013, 07:47:03 am
I'll use as the second server ip and 80 for the second port.
IPAddress serverIP(192,168,1,119);
int serverPort=8888;
IPAddress server2IP(192,168,1,120);
int server2Port=80;
Open a connection with server2IP and server2Port.
2811  Using Arduino / Storage / Re: Sdfat+w5100+Cosm on: April 23, 2013, 07:33:54 am
Then I guess it is something in Cosm.h causing the problem. How much SRAM do you have before and after the cosm() call?
2812  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield with Mega 2560 data feed drop out problems on: April 23, 2013, 07:24:06 am
If your code does not have all the error checking functions, it is a very common problem. You need to insure the w5100 socket rx buffer is empty and the server has closed its end (or timed out) before closing the connection. This code has all that:
The timeout code is very important. Without it, your connection will eventually lock up the Arduino if the server or connection fails. That happens a lot more often than you think.
2813  Using Arduino / Storage / Re: Sdfat+w5100+Cosm on: April 23, 2013, 07:16:06 am
Is that an Uno or Mega? If Uno, you are probably running out of SRAM. I use this function to check remaining SRAM. Call it in setup() and at places in the code that are failing.
int freeRam() {
  extern int __heap_start,*__brkval;
  int v;
  return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int) __brkval); 

void setup() {
  // all your setup stuff, then

  Serial.print(F("SRAM = "));
When you run out of SRAM, this won't show zero. It will show a negative number or an unreasonably large number.
2814  Using Arduino / Networking, Protocols, and Devices / Re: WiFi shield TCP to webserver is very slow on: April 22, 2013, 06:12:16 am
Since there is no client.send() command, I presume that each of these creates a separate packet, and is sent as the wifi card gets it, as does the ethernet shield. For example, this will send 4 packets.
      client.println("User-Agent: TestClient");
      client.println("Connection: close");

This is the same stuff sent as one packet.
     client.println("Host:\r\nUser-Agent: TestClient\r\nConnection: close\r\n");

If someone could use Wireshark and confirm this, that would take the presumption out of the equation.

edit: Some user suggested a client.send() command be added to the ethernet library. That would not be a bad idea. That way you could use the device buffer instead of the Arduino SRAM. It would go something like this to send one packet:
      client.println("User-Agent: TestClient");
      client.println("Connection: close");

edit2: To maintain legacy compatibility, it would require two new functions. One to prevent the immediate send, and another to send.
      client.println("User-Agent: TestClient");
      client.println("Connection: close");
2815  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shild on: April 22, 2013, 03:01:50 am
There are a few problems with that code. Take a look at this client code in the playground. It will display the webpage ok.
2816  Using Arduino / Installation & Troubleshooting / Re: Linux doesn't recognize Arduino Mega (no new records in dmesg output) on: April 21, 2013, 07:37:11 pm
I use a Mega with Ubuntu 12.10 now and then. It shows up as /dev/ttyACM0.

Check your user groups. you need dialout to access the Arduino.

You may need to add the dialout group to your user.
sudo usermod -aG dialout myusername
2817  Using Arduino / Networking, Protocols, and Devices / Re: TP Link, Mega 2560, Ethernet Shield, network configuration problem on: April 21, 2013, 07:16:14 pm
"It Works!" is normally the response from a Windows web server before you change the default page. That is not the Arduino.

Where did you get this IP address? This is not the router address. Are you sure that is not another computer?
IPv4 Address:
Subnet Mask:

edit: That TP Link router uses 192.168.0.x/24 on the ethernet. Read here about setting it up:
Open a Web Browser > Type in the address bar > Press Enter
2818  Using Arduino / Project Guidance / Re: Using Uno shields on Mega without wires! (Remap shield?) on: April 21, 2013, 02:10:40 pm
You mean you want a board so older Arduino shields that use D11-D13 for the SPI will work on a Mega or Leonardo? You could use a standard Uno-sized proto shield for the go-between if you use the ICSP pins to access the SPI data lines instead of D50-D52. There are a few available that have the ICSP connector included. Here is one for the Uno/Mega R3.

The SPI data lines are duplicated on the ICSP connector and D50-D52 on the Mega. The Leonardo has the SPI on the ICSP only.

It would require some jumpers tho.  smiley-confuse
2819  Using Arduino / Networking, Protocols, and Devices / Re: TP Link, Mega 2560, Ethernet Shield, network configuration problem on: April 21, 2013, 12:42:47 pm
That link to the TP Link setup shows the ethernet LAN addresses as 192.168.0.x and the gateway is Maybe you should check the setup in the router to make sure you have all that correct.

edit: In that case, this would be incorrect and would cause a connection fail.
  Ethernet.begin(mac, ip, gateway, subnet);
  // it should be
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
2820  Using Arduino / Installation & Troubleshooting / Re: Ethernet W5100 Shield - no COSM access whenever microSD installed. on: April 21, 2013, 12:36:29 pm
The setup is about the same as Surfer's but I don't have the

Without that on a Mega, it is almost always fatal. On the Uno, I think it is covered by the SD startup, but that would only apply if the default slave select is D10, but on a Mega it is D53.
Pages: 1 ... 186 187 [188] 189 190 ... 409