if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP"); // no point in carrying on, so do nothing forevermore: for(; ; } // give the Ethernet shield a second to initialize: delay(1000); Serial.println("connecting...");

// if you get a connection, report back via serial: if (client.connect(server, 1830)) { Serial.println("connected"); // Make a HTTP request: client.print("GET /logger/prueba_arduino.php?id_arduino="); client.print(1);

Firstly, WDvalenz can you please edit your first post and place your code with in code tags so I can read it clearly.You'll notice there is a smiley in your ethernet section as a result of not using code tags.

Secondly, from what I see in your function 'LeerSe()' you have in there the following;

I made that, I am trying to use recursiveness, when the reading is not property done then I try to read once again.

I changed the code now I am not using DHCP to get the ip adress, the code is smaller now but I am having a problem as the funtion Logger seems to "stop" the process is I coment the line it works perfectly but whe I want to try adding the Logger it does nothing. (Code tags added by moderator)

wdvalenz wrote:I made that, I am trying to use recursiveness, when the reading is not property done then I try to read once again.

If it fails it will do it again and again and again until the Arduino runs out of memory for the stack.You will need to change how you do this. Re-code it to have a retry loop which can be specified to retry a number of times, such as 3.If it doesn't succeed you return an error code and let the user know and put the Arduino into a specified condition.

Another thing you can do to help reduce your code it to use integer instead of floating point variables.Then at the display output, you format your data to represent floating point by dividing by a scale factor.For example, you declare 'float hum', and I assume this is humidity right?Humidity can be represented as 0 to 1000 as an integer with a 0.1% resolution. Then to display it, simply divide by ten to have it scaled 0.0% to 100.0%.

The difference is that you work with it as an integer during your program and that can significantly reduce your program size and the available processor ram used in calculations. I often keep sensor data as, what is called, raw, that is raw ADC format, so 0 to 1023 and then have the function that does the displaying do the necessary scaling into what is called engineering units.

So, to summerise, try to make as much of your data munching using variables with integer format where possible.

How does the Davis weather station present its data on the serial channel, as strings or binary or key/value pairs or what?What are the delimiters used to separate the data values from the Davis weather station? Again, more information!

Again, your commenting is lacking, it takes more work for me to understand your program, and I don't want to guess, so please comment.

Please be much more specific when you mention errors, not just

Quote

but whe I want to try adding the Logger it does nothing

That means absolutely nothing to me, and like I said before, I don't want or need to waste my time guessing all the time, please be much more accurate and specific with how you write.

If he is, then I think it just comes down to unhealthy programming practice.

I do not agree it is a unhealthy programming practice. I like verbose information and there is nothing unhealthy about it. If you put all those strings in flash memory you quickly fill up the memory. Then avrdude will refuse to upload the program stating it is to big.The F() macro was introduces around 1.0 to fix this problem and since then I have been using it intensively keeping verbose feedback and "small programs".

Quote from: rockwallaby on 19 February 2013, 20:38:26If he is, then I think it just comes down to unhealthy programming practice.

Quote

I do not agree it is a unhealthy programming practice. I like verbose information and there is nothing unhealthy about it. If you put all those strings in flash memory you quickly fill up the memory. Then avrdude will refuse to upload the program stating it is to big.The F() macro was introduces around 1.0 to fix this problem and since then I have been using it intensively keeping verbose feedback and "small programs".

Sorry Jantje, I think you misunderstood, I did not mean using flash memory instead of ram was bad, rather that the code as presented by the OP was generally constructed using 'bad programming practices'.

Look through his code for a few minutes and I think you will agree, that firstly it is difficult to read and understand and with a lack of code commenting, but more importantly, he is using recursive calls back into the same function, as I pointed out to the OP some posts back.

I too like a degree of verboseness in terms of commenting my code.

Yes, putting constant data in flash memory can help and is generally a good idea, but I doubt it will help sort out the problems with the program as presented by the OP.

So, wdvalenz, can you let us know how you are progressing with this code?

Paul wdvalenzI took a look at the first lines of code and I agree there is "room for code quality improvement"I did not look at the code enough to see how the "room for code quality improvement" relates to "smaller code size".

From a general advice point of view: In the "learning by doing" mindset of Arduino I believe the best advise for the OP is to start using the F() macro. This allows the OP to get back on the road and (s)he will improve coding skills over time by doing more sketches. The other way around: "improving coding skills first" will reduce the "doing"; which will reduce the "interest in the platform"; which will reduce the chances of "growing the Arduino community".

Best regardsJantje

Do not PM me a question unless you are prepared to pay for consultancy.Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -