Pages: [1]   Go Down
Author Topic: Sketch size small to Thingspeak and SD card writing together :(  (Read 593 times)
0 Members and 1 Guest are viewing this topic.
Online Online
Full Member
***
Karma: 1
Posts: 163
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...

* tempmonitor_ts.txt (7.01 KB - downloaded 9 times.)
* sdlog_ts.txt (1.81 KB - downloaded 6 times.)
Logged

California
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3350
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Online Online
Full Member
***
Karma: 1
Posts: 163
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

California
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3350
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Online Online
Full Member
***
Karma: 1
Posts: 163
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* fullos.ino (7.91 KB - downloaded 5 times.)
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Online Online
Full Member
***
Karma: 1
Posts: 163
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Online Online
Full Member
***
Karma: 1
Posts: 163
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

* fullos_cut.ino (6.72 KB - downloaded 6 times.)
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Online Online
Full Member
***
Karma: 1
Posts: 163
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 )... ??
Logged

Online Online
Full Member
***
Karma: 1
Posts: 163
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-sad
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
« Last Edit: November 12, 2012, 05:23:33 pm by vespapierre » Logged

Pages: [1]   Go Up
Jump to: