If u know what it may be Please let me know, even though rhis is not a priority atm.
Right now i am more focused on trying setting the mote in hybernation, and perform a task everyday at 23:00.
For testing I just sleep for 30 seconds and then do something.
I am having trouble however, i read that in hibernate the jumper has to be off, and I do that, but it seems very random when it works and when not, depending on "exactly" when I remove the jumper..
I used a code example from the forum here:
Code:
/*-----------------------------------------------------------
+++++ Set here time of sleeping period +++++
-----------------------------------------------------------*/
char * sleepTime = "00:00:00:20\0"; // 10 minutes
//char * sleepTime = "00:00:00:10\0"; // 10 seconds for testing
// +++++++++ Global variables ++++++++++
float sensorValue = 0; //stores measured ultrasonic sensor values
char frame[40];
void setup(){
USB.begin();
//////////// ONLY FIRST TIME /////////
//RTC.ON();
// Setting time. YY-MM-DD-XX-HH-MM-SS
//RTC.setTime("12:02:02:05:10:25:00");
//USB.println(RTC.getTime());
/////////////////////////////////////
// Checks if we come from a normal reset or an hibernate reset
PWR.ifHibernate();
}
void loop(){
Utils.blinkLEDs(1000);
// If Hibernate has been captured, execute hte associated function
if( intFlag & HIB_INT ) doStuff();
// Goes to Hibernate disconnecting all switches and modules
USB.println("Hibernating...");
PWR.hibernate(sleepTime,RTC_OFFSET,RTC_ALM1_MODE2); //!!!!!!!!!!!!!! hay que hacer alll off !! y cerrar la UART
}
// ++++++++++++++++++ PUBLIC FUNCTIONS ++++++++++++++
// measures sensor, builds frame and sends by GPRS
void doStuff(){
char value[10]; //stores sensor value
USB.println("Wake up! Doing stuff...");
// Measure values
// sensorValue = measureSensor();
sensorValue = 131;
Utils.float2String(sensorValue,value,0);
// Build frame.
RTC.ON();
sprintf(frame,"$%s; %s; %d;$",RTC.getTime(),value,PWR.getBatteryLevel() );
USB.print("Frame: ");
USB.println(frame);
// Send by GPRS
//sendByGPRS();
// save anything?
}
This works most of the time, however If I want to send the frame in a sms it doesn't work!
IT doesn't always get there (in the code) and sometimes do not even start (doesn't say hibernating..., which is in the start.)
Where do I have to put the sms code for the configuration:
Code:
//sendByGPRS();
GPRS_Pro.ON();
USB.println("GPRS_Pro module ready...");
// waiting while GPRS connects to the network
while(!GPRS.check());
USB.println("GPRS_Pro connected to the network");
// configure SMS and Incoming Calls
if(GPRS.setInfoIncomingCall()) USB.println("Info Incoming Call OK");
if(GPRS.setInfoIncomingSMS()) USB.println("Info Incoming SMS OK");
if(GPRS.setTextModeSMS()) USB.println("Text Mode SMS OK");
In the setup? in the start or after ifHibernate()?
Then the code that actually send the sms
Code:
uint8_t count = 0;
if(count==0){
// Utils.blinkLEDs();
// Utils.blinkLEDs(1000);
if(GPRS.sendSMS(frame,"+4521704476"))USB.println("SMS Sent OK");
if(GPRS.sendSMS(frame,"+4541294761"))USB.println("SMS Sent OK");
}
count++;
This code I put it in the section in the original code that stated: //GPRS code here.
Please help me out, this is important.