Go Down

Topic: serial output corruption with ethernet arduino (Read 885 times) previous topic - next topic


zoomkat

Just what are you trying to do? Are you sending a get request to a server and trying to capture data from what is sent from the server?
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

#17
Jan 04, 2013, 07:47 pm Last Edit: Jan 04, 2013, 07:51 pm by drewpalmer04 Reason: 1
Sending the GET command to the head unit. Then relay data to remote server. That server remotely displays data on a portal. But this code just sends GET then converts to the string output to relay it to the remote server.

zoomkat

Quote
But this code just sends GET then converts to the string output to relay it to the remote server.


If you are trying to pass a lot of html churn, then you might consider saving all the html text to an SD card, then sending the captured material from the SD card to the remote server.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Well it's not my server. I'm just trying to send the string to the server to display my data but the string gets corrupted at the end as seen in my above example

zoomkat

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

<RA><T1>804</T1><T2>698</T2><T3>773</T3><PH>862</PH><R>248</R><RON>0</RON><ROFF>255</ROFF><ATOLOW>0</ATOLOW><ATOHIGH>0</ATOHIGH><EM>0</EM><REM>0</REM><PWMA>84</PWMA><PWMD>76</PWMD></RA>


This is the entire string...it repeats over and over and changes the values depending on what the serial receives from the headunit for values. IE:<T1>804</T1> can be the temperature reading that can change to 805 709 etc etc.

zoomkat

You may need to check the http specs for query_string length limits. Might be something like 128 characters. longer than the limit you might need to use a post method.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.


You said that you have a sketch that just reads the serial data. So, after reading up the \n, how many characters are in the array? The readBytesUntil() method NULL terminates the array, so strlen() will tell you the length.



I'm sorry  but I can't get this function to work...could you lay it out in my code for me? So I can get an answer for you...Sorry I'm a noob

PaulS

Quote
I'm sorry  but I can't get this function to work...could you lay it out in my code for me? So I can get an answer for you...Sorry I'm a noob

Code: [Select]
      int b=Serial.readBytesUntil('\n',strout,sizeof(strout));
   int len = strlen(strout);


Of course, you could just print the value in b, instead. It should contain the same value as len.

issue resolved...thank you for everyone's help.

Go Up