Loading...
  Show Posts
Pages: 1 ... 156 157 [158] 159 160 ... 231
2356  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: March 21, 2012, 04:34:49 pm
I just tested client.write("QUIT\r\n") and it sends the whole string. It will still send a zero terminated string in v1.0.1. These work also:

client.write("STOR test.txt\r\n");
client.write("RETR test.txt\r\n");

edit: I go by the C header files in the libraries rather than the website documentation.
2357  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: March 21, 2012, 04:20:41 pm
Quote
client.write("(QUIT\r\n");
-> it's client.print("(QUIT\r\n"); (it's a real bug, because write only take the first char)

end in  eRcv() thisByte is a char. (it's just to be more clear)
->  char thisByte;

Ill go with the client.write(). That changed with v1.0 and later. It no longer takes a zero terminated string. My bad. It has been corrected.

The variable thisByte should be an int. That is the return value size on client.read().
2358  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: March 20, 2012, 11:19:10 am
I'll stick to your original with the error handling added. The changed have been applied to the code in reply #14.
2359  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: March 20, 2012, 11:06:49 am
1730 was the difference between the 2 codes. But if you use sscanf in a other part of your program, you will no see any difference between the 2 codes. (or just a few bytes)

I just checked it. Nice work. I see a little over 2K saved in IDE v1.0.1.

Give me a few minutes to edit the code.
2360  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: March 20, 2012, 09:34:30 am
That looks ok to me. I haven't tested it, but it looks good. How much memory does that save over the 1730 bytes?
2361  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: March 20, 2012, 06:52:37 am
This is the old code:
Code:
 char rtnVal[32];
  
  sscanf(outBuf,"%*s %*s %*s %*s %s",rtnVal);

  unsigned int hiPort,loPort;

  sscanf(rtnVal,"(%*u,%*u,%*u,%*u,%u,%u",&hiPort,&loPort);

This is the replacement code:
Code:
 char *tStr = strtok(outBuf,"(");
  tStr = strtok(NULL,"(");

  if(tStr == NULL)
  {
    Serial.println("No parenthesis");    
  }
  
  unsigned int hiPort,loPort;

  sscanf(tStr,"%*u,%*u,%*u,%*u,%u,%u",&hiPort,&loPort);

Give that a try and see if it does better. If that works for you, I will go back and edit the original code.

edit: I put the NULL test after the incorrect strtok call. It should be after the second strtok call. My bad.
2362  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: March 19, 2012, 02:42:38 pm
It seems easy enough to correct. I did not think about it at the time, but I should have used strtok() and set the token to "(" . That way it won't matter what the phrase is, only what is after the opening parenthesis.

I have not had time to try it today, but maybe this evening or tomorrow.



 
2363  Using Arduino / Networking, Protocols, and Devices / Re: Uploading file from SD card to remote server? on: March 19, 2012, 12:24:47 pm
Thanks for that info. I was wondering if all FTP servers returned that exact phrase, and I can see now they don't. I'll work on a replacement way to get the ip/port that is more universal.
2364  Using Arduino / Storage / Re: Arduino UNO + Arduino Ethernet Shield - can't read SD card on: March 19, 2012, 12:19:44 pm
Digital pin 4 is the SS for the SD card. Try this in your setup() routine:
Code:
Serial.print("Initializing SD card...");
  // disable the ethernet SPI
  pinMode(10, OUTPUT);
  digitalWrite(10,HIGH);

  // SD card SS pin is digital 4
  if (!SD.begin(4)) {
    Serial.println("failed!");
    return;
  }
  else
  {
    Serial.println("ok");
  }

edit: change bad spelling.
2365  Using Arduino / Storage / Re: SD Card Initialization Help on: March 18, 2012, 10:58:55 pm
This is mounted on an Uno, not a Mega, correct?

Other than that, I would suspect maybe it was not formatted correctly.
2366  Using Arduino / Storage / Re: SD Card Initialization Help on: March 18, 2012, 10:31:46 pm
Does it have a formatted microSD card in the slot?
2367  Using Arduino / Networking, Protocols, and Devices / Re: Connecting to server with Arduino, need some help.. on: March 18, 2012, 10:22:43 pm
If the server is using virtual hosting, you probably need to pass a "Host:" parameter in the GET request. Something like this:
Code:
   client.println("GET /index.html HTTP/1.0");
   client.println("Host: www.mydomain.com");
   client.println();
2368  Using Arduino / Project Guidance / Re: Non-Blocking web server on: March 18, 2012, 08:32:07 pm
So if I'm understanding right, the client.available function is NOT returning space available for outbound data, it's telling me how much incoming data there is?

That is correct. That is the receive buffer byte count.
2369  Using Arduino / Storage / Re: Ethernet Shield (SD Slot) & LCD combined problems on: March 18, 2012, 06:35:59 pm
Ah, I see. Thanks alot for the insight.
So there is no possible way for me to get a recording every 10 seconds as opposed to 16-17 seconds?

I did not look at the rest of the code to see where the holdup is. You should not have any problem with a 10 second update. The files take about a second at the most.

You will need to figure out in your code where the time is being spent. Six to seven seconds should be easy to find with some well-placed Serial.println("At X") statements. Watch the serial monitor and wait for the unexpected pause in serial output.

2370  Using Arduino / Project Guidance / Re: Non-Blocking web server on: March 18, 2012, 06:29:08 pm
I see what you mean. In that respect, it is blocking. If the tx buffer is full, it will wait for space to be available. It requires modifications to the ethernet library to access the function that provides that info.

uint16_t W5100.getTXFreeSize(SOCKET s);

Are you up to that?
Pages: 1 ... 156 157 [158] 159 160 ... 231