@draythomp
Information from pachube is read and spit out. The things I am storing are the total number of pulses, and the liter total.the hotel uses about 1,000,000 liters per month, so I think I will be ok measuring those values.
I have implemented PSTR() code at your suggestion...very straightforward and impressive the amount of RAM it clears up.
I am attaching a very simplified version of the code I use to receive indefinitely. This is without any calls to ethernet lib:
//INCLUDES
#include <Ports.h> //JeeLabs
#include <RF12.h> //RFM12b driver
#include <Wire.h>
#include <RTClib.h> //JeeLabs RTC
//Globals definition
unsigned long time=0;
RTC_Millis RTC;
//analogous data structure for incoming data
typedef struct {
int cnt;
unsigned long time; //ellapsed time since last reading
byte bat;
int p1, p2, p3, p4; //pulses
}
Payload;
Payload inData;
void setup () {
Serial.begin(57600);
RTC.begin(DateTime(__DATE__, __TIME__));
rf12_config();
}
static void consumeInData () {
DateTime now = RTC.now();
Serial.print(now.year(), DEC);
Serial.print("/");
Serial.print(now.month(), DEC);
Serial.print("/");
Serial.print(now.day(), DEC);
Serial.print(" ");
Serial.print(now.hour(), DEC);
Serial.print(":");
Serial.print(now.minute(), DEC);
Serial.print(":");
Serial.print(now.second(), DEC);
Serial.println();
inData = *(Payload*) rf12_data;
Serial.print("+++++++++++++++++++++++++++++++++++++++");
Serial.println();
Serial.print("id: ");
Serial.print(rf12_hdr, DEC);
Serial.print(" msg:");
Serial.print(inData.cnt);
Serial.print(" time:");
Serial.print(inData.time);
Serial.print(" bat:");
Serial.print(inData.bat, DEC);
Serial.println();
Serial.print(" p1: ");
Serial.print(inData.p1);
Serial.print(" p2: ");
Serial.print(inData.p2);
Serial.print(" p3: ");
Serial.print(inData.p3);
Serial.print(" p4: ");
Serial.print(inData.p4);
Serial.println();
}
void loop () {
if (rf12_recvDone() && rf12_crc == 0 && rf12_len == sizeof inData) {
memcpy(&inData, (byte*) rf12_data, sizeof inData);
// optional: rf12_recvDone(); // re-enable reception right away
consumeInData();
time = millis();
}
else{
if((millis()-time)>10000){
Serial.print("something wrong...");
delay(2000);
}
}
}
I am attaching the code with ethernet.
The code base the same as above, but I borrowed a lot of code from:http://www.designspark.com/content/pachube-making-reliable-connections-arduino because I liked the design of the code. Note that ALL examples I have tried (included Pachube sketches with ethernet lib and pachube libraries) all result in more or less the same behavior which is: arduino starts, receives from RFM12b, sends data out to pachube, is successful for a while, but then (5-25) minutes later, it seems something disables the ability to receive.
What would be a straightforward test to understand if the Ethernet Shield (+lib) and the RFM12b are conflicting at some point? For example, when I cannot receive, right now I go into an 'else' condition that prints 'something is wrong.' Could I do something there to understand why I can no longer receive or to recover?
A_receiveFlowData5_5_SIMPLE_send3.zip (4.17 KB)