Go Down

Topic: Sketch size small to Thingspeak and SD card writing together :( (Read 781 times) previous topic - next topic

vespapierre

Hi,

I would like to ask your help. I'm not a professional in Arduino. I have created to different skecth. One of it is working with thingspeak. Other one just logging to SD card. (Duemilanove/ATmega328)
My problem is if I try to use them together, sketch size will be small. Now using Arduino 1.0.1. (temp values are still not defined in to write to SD).
I appreciate you help!
Codes are attached. I have tried to check use progmem, but I am not so good after years...

Arrch


sketch size will be small.

That's not usually a problem...

Can you post how you have tried combining them and better explaining your issue?

vespapierre

I will try, sorry for my english. So I'm just arround on a beginner level ( I guess) in programming with Arduino. I have tried to merged the setup and loop parts. After I have tried to remove the serial.print -s as much as I can, not to use float-s but the sketch size was arround 34K.

Arrch


I will try, sorry for my english. So I'm just arround on a beginner level ( I guess) in programming with Arduino. I have tried to merged the setup and loop parts. After I have tried to remove the serial.print -s as much as I can, not to use float-s but the sketch size was arround 34K.


I fail to see how a 34K sketch size would be considered "small"

I also fail to see any code that shows how you tried to merge them.

billroy

You're trying to merge two of the biggest Arduino libraries (SD and Ethernet) so the result is going to be tight.  There is a lot of Serial.print() overhead that is contributing to both ram size and program size -- that's clearly the place to start code reduction.

If you post your combined sketch here you're much more likely to get help.

-br

vespapierre

ok, I have attached the full code, sorry. Arduino 1.0.1 says sketch size is 35515 byte and maximum is 30720.

billroy

If you cut way, way down on the Serial.print() diagnostics I bet it will fit.

Make a copy and slice away on the copy.  Let us know how you do.  At least it is a fast thing to try.

You'll want to learn about the F() macro for any remaining printing, because ram pressure is scheduled to be your next big worry.

-br

vespapierre

You mean I should delete the serial.print()-s ? Ok, I will do it now!

vespapierre

I have removed and commented out all the serial.print()-s. Size is now 33684 and maximum is 30720...What can I do more?
Attached the sketch again.

billroy

Thanks for the update.  You did some good cutting.  I took a hard look and I don't see any further reductions that would make up the 3k difference.  I'm surprised. 

You are wedged between two big libraries.  An Arduino Mega would solve your flash problem, as well as the ram problems you haven't run into yet.

-br


vespapierre

Oh ...said news. Are there any other possibility? Maybe completely rebuild the temp monitor sketch side...or use other solution instead of thingspeak? I would be very happy if I could manage to do this with your or any other help.
Maybe rebuild the code to put things to flash ( I'm not familiar with it )... ??

vespapierre

#11
Nov 12, 2012, 11:15 pm Last Edit: Nov 12, 2012, 11:23 pm by vespapierre Reason: 1
I have moved to Mega 2560. I did the hack found below here:
http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/
Result: Just trying to connect to network, but nothing happens. I did the 4 pin hack and the 3 pin hack too...now it is on 4 pin modification...
Help me plz :(
Thanks!
Oh and I'm using Arduino 101. Because I did not found exactly the code what the hacking said, I have put the code to the sketch:
#define SPI0_SS_BIT BIT0
#define SPI0_SCLK_BIT BIT1
#define SPI0_MOSI_BIT BIT2
#define SPI0_MISO_BIT BIT3
#define IINCHIP_CS_BIT BIT0

Even tried it before Setup() and in setup() ...doesn't working...


BR

Go Up