Go Down

Topic: Mega with wiznet shield (wire hack)+thingspeak+sd problem (Read 5 times) previous topic - next topic

vespapierre

oh yes...I will double check the DS18b20...now I'm excited about the SD :)


Did you see my edit to my last post? The value returned may be in 1/4 degrees Celsius.
85 / 4 = 21.25 degrees.
Is that about right?


wildbill

85 is the value the DS18B20 returns when it hasn't read the temperature. Discussed again recently in this thread:
http://arduino.cc/forum/index.php/topic,133319.msg1003240.html#msg1003240

SurferTim


85 is the value the DS18B20 returns when it hasn't read the temperature. Discussed again recently in this thread:
http://arduino.cc/forum/index.php/topic,133319.msg1003240.html#msg1003240

And this seems to be the final piece of the puzzle for you.
Thanks, wildbill!  :)

vespapierre

#28
Nov 21, 2012, 09:22 pm Last Edit: Nov 21, 2012, 09:29 pm by vespapierre Reason: 1
Thanks wildbill, I will put initial sensor readings to setup.

Tim,

can you help me out of this SD code? What and where should I put? Should I stay at my code or better to use your ftp like?

edit: after initial reading of sensors in setup() 85 degrees at the start disappeared, thanks again!

SurferTim

Since you have the values in the loop() function, I would put the SD routine immediately after the getPage() call. Like this:

Code: [Select]
if(!logFile(temp0,temp1)) Serial.println("Log failed");
else Serial.println("Log ok");


Here is logFile:
Code: [Select]
int logFile(int temp0, int temp1) {
  File fh = SD.open("test.txt",FILE_WRITE);

  if(!fh) {
    Serial.println("Open fail");
    return 0;
  }

  // Use the same character array here to send stuff to the file.
  // pageAdd array is global
  sprintf(pageAdd,"Field1=%u Field2=%u",temp0,temp1);
  fh.println(pageAdd);
  fh.close();
  return 1;
}


Go Up