Mega with wiznet shield (wire hack)+thingspeak+sd problem

If you are indeed short of SRAM, you can benefit from the usual recommendation to use the F macro to wrap all your constant strings - you have rather a lot of them, particularly in your serial.prints

Which pin is the OneWire pin? That is the one with the Dallas temp sensor, correct?

wildbill, i should learn a lot I know but I don't know much about F macros. I gues mega should not run out of SRAM with this...

Tim,
yes,

this is pin 3.(digital)

OK, add just this. We'll try initializing the OneWire.

#include <OneWire.h>

// DS Temperature chip i/o
OneWire ds(3);  // on pin 3

Does that fail also?

From the release notes:

Support has been added for printing strings stored in flash (program
memory) rather than RAM. Wrap double-quoted strings in F() to indicate
that they should be stored in flash, e.g. Serial.print(F("hello world"))

But as you're using a Mega, it may be a moot point.

Wildbill, thanks I will try that.

Tim,

firts attempt is failed. Second, third, fourth is ok.

after power down and up again, it is failing for every attempt

edit: after rewriting with the F macros the sd open failed too

This page has an example sketch for the Dallas temp sensor.
http://www.arduino.cc/playground/Learning/OneWire
It does not include any header files except OneWire.h. Maybe that will help you get it set up. Compile and upload the example sketch and insure it works ok. If it does, then we'll rename that "loop" function to something else and add it to your sketch.

edit: Don't use the F() macro yet. Keep it as simple as possible. Add the fancy stuff later.
If it fails to start the SD, then something is not right. If you comment out the new include and declaration, does it work again? If so, you might want to try contacting Paul Stoffregen or checking his website.
http://www.pjrc.com/teensy/td_libs_OneWire.html
Maybe he has something that would help.

Also, post a link to the ethernet shield/sd card setup that you are using. Some old shields used funny digital pins for other stuff.

ok, i will try this example.

I am using this shield for sd and ethernet what is the same as w5100
http://avr.tavir.hu/modules.php?name=Asers_Shop&s_op=viewproductdetails&lid=141&cid=27

Tim this example is working and showing the addresses on serial monitor...

I am a bit confused about this:

SurferTim:
... If it does, then we'll rename that "loop" function to something else and add it to your sketch.
..

What do you mean?

Just as a test, can you move the sensor to pin D5? It looks like D3 and D4 have something on them. There are traces on the top of the shield running to those pins from some device on the shield. ??

Take a look:

Insure there are no traces going to pin D5 on the other side of that shield.

edit: Just a word of advice. Get all the hardware working together in their most simple form. Do not continue until then.

?? I should solder the wiznet D3 pin out ( bend d5 too ) and wire that to the boards d5 pin?

There is a trace, because onewire RJ11 socket is connected to d3.

oh and on d4 a led can be defined in the code, so there is a led.

If that is the OneWire from the connector only, then use pin 3. Insure nothing else is connected there. I am not familiar with that ethernet shield hardware. You will need to determine why this code makes it fail.

#include <OneWire.h>

// DS Temperature chip i/o
OneWire ds(3);  // on pin 3

edit: I see pin 3 going around to an SOIC chip, not the RJ11. Follow it around. I guess that is a 3.3v input to that smd IC device due to the 2.2k resistor set forming a voltage divider.

Tim,
this is the picture of my shield...

edit: changed the picture...

as the manufacturer said to me, d3 is the onewire, where is also a ds18 on the board and RJ11. I'm getting angry for this shield... =(
maybe i should try to implement somehow the code what you sent about to mine...?
i mean this one:
http://www.pjrc.com/teensy/td_libs_OneWire.html

I think I see now. The Dallas is directly mounted to the board, correct? But I am not sure where else D3 goes. It looks like that trace continues after the 2.2k resistor through that "T" and around to the 8 pin IC at the top of the board. I don't know what that does.

yes you are right...here is another view

If you can't add this to your new code (reply #46), then you can't use the other code either. It uses OneWire.

#include <OneWire.h>

// DS Temperature chip i/o
OneWire ds(3);  // on pin 3

If adding this makes the SD fail, there is a conflict somewhere. You must determine what that is.

Just to be sure...pin definition and enable/disable 'devices'...
So I'm using the realtime clock, onewire( digital pin3), sd card( digital pin8), and wiznet (digital pin 10). Shield has no ICSP connection.

Please confirm, I should enable/disable the devices.

inputs and outputs : sdcard( 8 ), wiznet(10) and onewire (3) should be defined as an output, is it right? ( on onewire currently there are 3 ds18b20 )
enable/disable: put the pin to LOW state will enable the 'device', put the pin to HIGH state will disable that. Is it right?

for example here before I should enable wiznet, and disable SD and onewire:

//in the setup()

pinmode(8,OUTPUT);
pinmode(10,OUTPUT);
pinmode(3,OUTPUT);


//in loop() for example


digitalwrite(10,LOW);
digitalwrite(8,HIGH);
digitalwrite(3,HIGH);

if(!getPage(server,pageAdd)) Serial.print("Fail ");
    else Serial.print("Pass ");

Are these correct?

Are these correct?

No. Once all the SPI slave selects are set HIGH in setup, they no longer need to be manipulated. The libraries do that.

// in setup()
pinmode(8,OUTPUT);
pinmode(10,OUTPUT);
pinmode(3,OUTPUT);
digitalwrite(10,HIGH);
digitalwrite(8,HIGH);
digitalwrite(3,HIGH);

//in loop() for example. Only the w5100 SPI will be selected.
// all other slave selects are HIGH (disabled)

if(!getPage(server,pageAdd)) Serial.print("Fail ");
    else Serial.print("Pass ");