Go Down

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


Nov 21, 2012, 08:31 pm Last Edit: Nov 21, 2012, 08:34 pm by SurferTim Reason: 1
That sounds like this:
Code: [Select]
edit: Insure the character array pageAdd has enough storage for the string.


Nov 21, 2012, 08:40 pm Last Edit: Nov 21, 2012, 08:43 pm by vespapierre Reason: 1
I'm going to be happy :)
current code is here:

answer is:
Starting ethernet...
Starting SD...ok Ready
Locating devices...Found 1 devices.
Parasite power is: OFF
Found device 0 with address: 1092942902080056
Getting temperatures...

Temperatures are 85 Celsius, 0 Celsius, 0 Celsius,

HTTP/1.1 200 OK
Server: nginx/0.8.53
Date: Wed, 21 Nov 2012 19:36:14 GMT
Content-Type: text/html; charset=utf-8
Connection: close
Vary: Accept-Encoding
Status: 200
ETag: "d53697441ef12a45422f6660202f9840"
Cache-Control: max-age=0, private, must-revalidate

Pass 1

85 degrees is maybe some kind of delay I guess...
we are almost at the start of writing to SD :)

edit: I have modified the char array to 140. As API documentation said that is the maximum.  Can I modify later the temp as float?


Nov 21, 2012, 08:57 pm Last Edit: Nov 21, 2012, 09:08 pm by SurferTim Reason: 1
Watch out for type float. If you try to use that type in sprintf, the result will be "?" where you expected the value to be. You need to convert that float to a string first.

Is the value returned from the temperature sensor a float type? Or integer?

edit: Some devices return the temperature in fractions of a degree, like half or quarter of a degree. 85 may be in quarter degrees. That would be 21.25 degrees Celsius.


Nov 21, 2012, 09:07 pm Last Edit: Nov 21, 2012, 09:11 pm by vespapierre Reason: 1
I have tried that, I will stay at integer ( i gues return value can be a float)...I hope it will show negative values.
Facing to SD writing...I have put the SD code what you wrote to the setup().
Can you help how should I go ahaed?

it was my original SD code:

Code: [Select]

#include <Wire.h>
#include <OneWire.h>
#include <Rtc_Pcf8563.h>
#include <SD.h>

//init the real time clock
Rtc_Pcf8563 rtc;

// Global variables
const int period = 30000;
const int chipSelect = 8;

void setup()
 String message="";
 pinMode(8, OUTPUT);
  if (!SD.begin(chipSelect))
   Serial.println("Card failed");
 Serial.println("Card init");
 File logFile = SD.open("errorlog.txt", FILE_WRITE);
 if (logFile)
   message = String(rtc.formatDate(RTCC_DATE_ASIA)) + " " + String(rtc.formatTime());
   logFile.println("Progstart: " + message);
   Serial.println("Progrstart: "  + message);
// if the file isn't open, pop up an error:
   Serial.println("cannot open errorlog.txt");

void loop()
// make a string for assembling the data to log:
 String dataString = "";
 String sDate = "";
 String sTime ="";
   sTime=rtc.formatTime();               //read formatted time from i2C RTC
   sDate=rtc.formatDate(RTCC_DATE_ASIA); //read formatted date from 12C RTC

 Serial.print(" ");
  dataString += String(sDate + ";" + sTime + ";");
 File dataFile = SD.open("datalog.txt", FILE_WRITE);
 if (dataFile)
// print to the serial port too:
 // if the file isn't open, pop up an error:
   Serial.println("cannot open datalog.txt");

or should I use your ftp code?? Seems I will need your further help  :smiley-red:


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?

Go Up