Sketch only runs one even though its on a timer

I have this sketch that is designed to fire an alarm every 1 hour, calling the method MainAlarm.

The MainAlarm() samples T&H and stores the data for processing. Every hour after MainAlarm() samples, it checks to see if a counter has reached 8. If it hasnt reached 8, then it simply stores the data in an array (and adds 1 to the counter), else if its greater than 8 it resets the counter to 0 and sendData().

sendData() starts the SIM module, parses the array into a string and sends the string in an SMS. It is done once, I get the SMS, but it is not continued. The SIM module appears to be registered onto the network and waiting for more action but nothing happens.

If MainAlarm() is fired every hour, T&H are sampled every hour. My SMS is here and the code is as follows. Why is the sim module stopping after 1 sms?

#include <Time.h>
#include <TimeLib.h>
#include <SoftwareSerial.h>
#include <TimeAlarms.h>
#include <dht.h>

dht DHT;
#define DHT11_PIN 5
char number[]="+mynumber";
boolean started=false;
SoftwareSerial sim900(9,10);

int smsSampleCount=0; //how many samples i want in the array
typedef struct {
  int timeStamp;
  double tempSample;
  double humSample;
} samplePoint;

samplePoint finalDataArray[10];


void setup(){
  Serial.begin(9600);
  Alarm.timerRepeat(3600, MainAlarm); // 1hrx60=60*60=3600
}

void loop(){
  Alarm.delay(10); // wait one second between clock display
}

void MainAlarm(){
  Serial.println("Main Alarm...");
  int chk = DHT.read11(DHT11_PIN);
  Serial.print("Temperature = ");
  double temp = DHT.temperature;
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  double hum = DHT.humidity;
  Serial.println(DHT.humidity);
  
  if (smsSampleCount<8) {
    finalDataArray[smsSampleCount].timeStamp = smsSampleCount;
    finalDataArray[smsSampleCount].tempSample = temp;
    finalDataArray[smsSampleCount].humSample = hum;
    printDataCollectedSoFar();
    smsSampleCount++;
   } else { // else reset counter and send data.
    Serial.println("Sending data");
    smsSampleCount=0;
    sendData();
   }
}

void printDataCollectedSoFar() {
  Serial.println("Printing data");
  int x = 0;
  while (x<7) {
    Serial.println(finalDataArray[x].timeStamp);
    Serial.println(finalDataArray[x].tempSample);
    Serial.println(finalDataArray[x].humSample);  
    x=x+1;
  }
}

void sendData(){
  sim900.begin(9600); //Default serial port setting for the GPRS modem is 19200bps 8-N-1

  static char outTempStr[15];
  static char outHumStr[15];
  static String finalString;

  int numElements = sizeof(finalDataArray) / sizeof(finalDataArray[0]);
  
  for (int i=0; i<numElements;i++){
    String tempString = dtostrf(finalDataArray[i].tempSample,5,2,outTempStr);
    String humString = dtostrf(finalDataArray[i].humSample,5,2,outHumStr);
    finalString = finalString+":"+tempString+"/"+humString+"-";
  }
  Serial.println(finalString);
  delay(5000);
  sim900.print("\r");
  delay(1000);
  sim900.print("AT+CMGF=1\r"); 
  delay(1000);
  sim900.print("AT+CMGS=\"+mynumber\"\r");
  delay(1000);
  sim900.print(finalString + "\r"); 
  Serial.println("sent!");
  delay(1000);
  sim900.write(0x1a);
  sim900.println(char(26));
  Serial.println("done!!");
}

Not sure it would change something but try having the sim900.begin(9600); in the setup rather than calling it every time?

What does the serial console says? You have lots of logs

But if I do that and the module loses connection to the network for any reason, it won't register again. But I'll try it.

It's not plugged in right now but when it was plugged in to the laptop it would keep printing the array elements and it would print the logs where data was sent but it was not sent.

Have you configured the module to use low power and go to sleep in Slow Clocking mode?

AT+CSCLK=1 to set mode, sleep mode is an autonomous operation in the SIM900, after DTR is set high sleep mode is entered after a couple of seconds. To be able to issue any commands to the SIM900 after this requires that DTR is low.

Oh yeah I think I tried that once and set it like this:

AT+CSCLK=2

Ill set it back...thanks!

Btw, what does the manual mean by:

AT+CSCLK=2 means the module will decide when it goes to sleep and when it wakes up?

Im trying to figure out how to wake up the module which will be standalone (without a serial connection to a laptop). So Im thinking that I can make my sketch set a pin high to make the sim900 wake up.

Yes typical process would be to set up sleep mode and have a pin for DTR and drive it high or low for sleep and wake up to command mode. That will save power as well

Ok I modified the sketch to include the AT+CSCLK=0 and moved the sim.begin() to setup() but I still get the sms sent only once.

Here is my current code:

#include <Time.h>
#include <TimeLib.h>
#include <SoftwareSerial.h>
#include <TimeAlarms.h>
#include <dht.h>
//#include "SIM900z.h"

dht DHT;
#define DHT11_PIN 5
boolean started=false;
SoftwareSerial sim900(9,10);

int smsSampleCount=0; //how many samples i want in the array
typedef struct {
  int timeStamp;
  double tempSample;
  double humSample;
} samplePoint;

samplePoint finalDataArray[10];


void setup(){
  Serial.begin(9600);
  sim900.begin(9600); //Default serial port setting for the GPRS modem is 19200bps 8-N-1
  Alarm.timerRepeat(3600, MainAlarm); 

void loop(){
  Alarm.delay(10); // wait one second between clock display
}

void MainAlarm(){
  Serial.println("Main Alarm...");
  int chk = DHT.read11(DHT11_PIN);
  Serial.print("Temperature = ");
  double temp = DHT.temperature;
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  double hum = DHT.humidity;
  Serial.println(DHT.humidity);
  
  if (smsSampleCount<8) {
    finalDataArray[smsSampleCount].timeStamp = smsSampleCount;
    finalDataArray[smsSampleCount].tempSample = temp;
    finalDataArray[smsSampleCount].humSample = hum;
    printDataCollectedSoFar();
    smsSampleCount++;
   } else { // else reset counter and send data.
    Serial.println("Sending data");
    smsSampleCount=0;
    sendData();
   }
}

void printDataCollectedSoFar() {
  Serial.println("Printing data");
  int x = 0;
  while (x<7) {
    Serial.println(finalDataArray[x].timeStamp);
    Serial.println(finalDataArray[x].tempSample);
    Serial.println(finalDataArray[x].humSample);  
    x=x+1;
  }
}

void sendData(){
  static char outTempStr[15];
  static char outHumStr[15];
  static String finalString;

  int numElements = sizeof(finalDataArray) / sizeof(finalDataArray[0]);
  
  for (int i=0; i<numElements;i++){
    String tempString = dtostrf(finalDataArray[i].tempSample,5,2,outTempStr);
    String humString = dtostrf(finalDataArray[i].humSample,5,2,outHumStr);
    finalString = finalString+":"+tempString+"/"+humString+"-";
  }
  Serial.println(finalString);
  delay(1000);
  sim900.print("\r");
  delay(1000);
  sim900.print("AT+CSCLK=0\r"); //NO SLEEP
  delay(1000);
  sim900.print("AT+CMGF=1\r"); //text mode
  delay(1000);
  sim900.print("AT+CMGS=\"+mynumber\"\r");
  delay(1000);
  sim900.print(finalString + "\r"); //The text for the message
  Serial.println("sent!");
  delay(1000);
  sim900.write(0x1a); //Equivalent to sending Ctrl+Z
  sim900.println(char(26));
  Serial.println("done!!");
}

I just got an sms again, which would make it 12 hours between message.

Why don't you make your life easy for debug and have the SMS sent everybody minute to see what's going on? print also the serial answers of your SIM900 messages you do zero error check there nor do you know what's going on (and drop the String class use)

I will. Im working on the debug. Ive been thinking of a couple of things:

FIRST

void sendData(){
  static char outTempStr[15];
  static char outHumStr[15];
  static String finalString;

  int numElements = sizeof(finalDataArray) / sizeof(finalDataArray[0]);
  
  for (int i=0; i<numElements;i++){
    String tempString = dtostrf(finalDataArray[i].tempSample,5,2,outTempStr);
    String humString = dtostrf(finalDataArray[i].humSample,5,2,outHumStr);
    finalString = finalString+":"+tempString+"/"+humString+"-";
  }

  //samplePoint finalDataArray[10]; ***********************

  Serial.println(finalString);
  delay(1000);
  sim900.print("\r");
  delay(1000);
  sim900.print("AT+CSCLK=0\r"); //NO SLEEP
  delay(1000);
  sim900.print("AT+CMGF=1\r"); //text mode
  delay(1000);
  sim900.print("AT+CMGS=\"+mynumber\"\r");
  delay(1000);
  sim900.print(finalString + "\r"); //The text for the message
  Serial.println("sent!");
  delay(1000);
  sim900.write(0x1a); //Equivalent to sending Ctrl+Z
  sim900.println(char(26));
  Serial.println("done!!");
}

Im thinking of adding that **** line to reset my array after the data is sent so that when the new data is populated, its done over a new clean instance of the array.

SECOND
Im thinking of how to add a the code to make it sleep and wake up in order to save energy, but before that I need to get it sending sms consistently because so far Im getting an SMS sent 27 hours later, and a second one 18 hours later. So Im going to add the debugs after letting it run for about 10 days to see what the pattern is, if any.

If you have 10 days to waste sure...

I'd start by making sure the code is correctly working printing out things to the console and I'll accelerate reading the data so that I don't need to wait hours to see this work by changing the timing. Then learn how to sleep your arduino in between the data collection.

Once all is working well for Serial printing I'll put that code aside and play around with your SMS sending code. Build something that does AT command answer printing and check you get to something that reliably sends out SMS every single time. Then lean to sleep and wake up your module.

Then merge everything you learn.

Don't leave it out to guess work

Ok, Here is the code and the results for building the array with the samples taken:

#include <Time.h>
#include <TimeLib.h>
#include <SoftwareSerial.h>
#include <TimeAlarms.h>
#include <dht.h>

dht DHT;
#define DHT11_PIN 5
SoftwareSerial sim900(9,10);

int smsSampleCount=0; //how many samples i want in the array
typedef struct {
  int timeStamp;
  double tempSample;
  double humSample;
} samplePoint;

samplePoint finalDataArray[10];


void setup(){
  Serial.begin(9600);
  sim900.begin(9600); //get modem ready
  delay(1000); //wait for modem before 
  Alarm.timerRepeat(3600, MainAlarm); // 1hrx60=60*60=3600
  Serial.println("Alarm set!");
}

void loop(){
  Alarm.delay(10); // wait one second between clock display
}

void MainAlarm(){
  Serial.println("Main Alarm fired!");
  int chk = DHT.read11(DHT11_PIN);
  Serial.print("Temperature = ");
  double temp = DHT.temperature;
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  double hum = DHT.humidity;
  Serial.println(DHT.humidity);
  
  if (smsSampleCount<8) {
    finalDataArray[smsSampleCount].timeStamp = smsSampleCount;
    finalDataArray[smsSampleCount].tempSample = temp;
    finalDataArray[smsSampleCount].humSample = hum;
    smsSampleCount++;
    Serial.print("Data added with count =");
    Serial.println(smsSampleCount);
   } else { // else reset counter and send data.
    Serial.println("Reached 7, will send data!");
    smsSampleCount=0;
    //check to see if modem is ready
    sendData();
   }
}

void printDataCollectedSoFar() {
  Serial.println("Printing data");
  int x = 0;
  while (x<7) {
    Serial.println(finalDataArray[x].timeStamp);
    Serial.println(finalDataArray[x].tempSample);
    Serial.println(finalDataArray[x].humSample);  
    x=x+1;
  }
}

void sendData(){
  //Setup local vars for temp/hum strings
  static char outTempStr[15];
  static char outHumStr[15];
  static String finalString;

  int numElements = sizeof(finalDataArray) / sizeof(finalDataArray[0]);
  
  for (int i=0; i<numElements;i++){
    String tempString = dtostrf(finalDataArray[i].tempSample,5,2,outTempStr);
    String humString = dtostrf(finalDataArray[i].humSample,5,2,outHumStr);
    finalString = finalString+":"+tempString+"/"+humString+"-";
  }
  Serial.print("Parsed finalString =");
  Serial.println(finalString);
  Serial.println("Resetting array!");
  samplePoint finalDataArray[10];

  //DEBUG ONLY
  // Check if modem ok
  delay(1000);
  sim900.println("AT");
  delay(1000);
  printRead();//**********************************************ADDED********
  
  sim900.print("\r");
  delay(1000);
  
  sim900.print("AT+CSCLK=0\r"); //NO SLEEP
  delay(1000);
  printRead();
  
  sim900.print("AT+CMGF=1\r"); //text mode
  delay(1000);
  
  sim900.print("AT+CMGS=\"+mynumber\"\r");
  delay(1000);
  
  sim900.print(finalString + "\r"); //The text for the message
  Serial.println("sent!");
  finalString = ""; //****************************************LINE ADDED********
  delay(1000);
  sim900.write(0x1a); //Equivalent to sending Ctrl+Z
  sim900.println(char(26));
  Serial.println("done!!");
}
//**********************************************METHOD ADDED********
void printRead() {
  char datain;
  while(sim900.available()>0){
    datain=sim900.read();
    if(datain>0){
      Serial.print(datain);
    }
  }
}

Results:

Alarm set!
Main Alarm fired!
Temperature = 30.00
Humidity = 37.00
Data added with count =1
Main Alarm fired!
Temperature = 31.00
Humidity = 36.00
Data added with count =2
Main Alarm fired!
Temperature = 32.00
Humidity = 33.00
Data added with count =3
Main Alarm fired!
Temperature = 36.00
Humidity = 33.00
Data added with count =4
Main Alarm fired!
Temperature = 37.00
Humidity = 32.00
Data added with count =5
Main Alarm fired!
Temperature = 36.00
Humidity = 32.00
Data added with count =6
Main Alarm fired!
Temperature = 33.00
Humidity = 34.00
Data added with count =7
Main Alarm fired!
Temperature = 30.00
Humidity = 35.00
Data added with count =8
Main Alarm fired!
Temperature = 29.00
Humidity = 35.00
Reached 7, will send data!
Parsed finalString =:30.00/37.00-:31.00/36.00-:32.00/33.00-:36.00/33.00-:37.00/32.00-:36.00/32.00-:33.00/34.00-:30.00/35.00-: 0.00/ 0.00-: 0.00/ 0.00-
Resetting array!
sent!
done!!
Main Alarm fired!
Temperature = 28.00
Humidity = 33.00
Data added with count =1
Main Alarm fired!
Temperature = 27.00
Humidity = 31.00
Data added with count =2
Main Alarm fired!
Temperature = 27.00
Humidity = 31.00
Data added with count =3
Main Alarm fired!
Temperature = 27.00
Humidity = 30.00
Data added with count =4
Main Alarm fired!
Temperature = 26.00
Humidity = 30.00
Data added with count =5
Main Alarm fired!
Temperature = 25.00
Humidity = 31.00
Data added with count =6
Main Alarm fired!
Temperature = 25.00
Humidity = 32.00
Data added with count =7
Main Alarm fired!
Temperature = 25.00
Humidity = 32.00
Data added with count =8
Main Alarm fired!
Temperature = 24.00
Humidity = 34.00
Reached 7, will send data!
Parsed finalString =:30.00/37.00-:31.00/36.00-:32.00/33.00-:36.00/33.00-:37.00/32.00-:36.00/32.00-:33.00/34.00-:30.00/35.00-: 0.00/ 0.00-: 0.00/ 0.00-:28.00/33.00-:27.00/31.00-:27.00/31.00-:27.00/30.00-:26.00/30.00-:25.00/31.00-:25.00/32.00-:25.00/32.00-: 0.00/ 0.00-: 0.00/ 0.00-
Resetting array!
sent!
done!!
Main Alarm fired!
Temperature = 24.00
Humidity = 35.00
Data added with count =1
Main Alarm fired!
Temperature = 24.00
Humidity = 34.00
Data added with count =2
Main Alarm fired!
Temperature = 25.00
Humidity = 34.00
Data added with count =3
Main Alarm fired!
Temperature = 27.00
Humidity = 34.00
Data added with count =4
Main Alarm fired!
Temperature = 28.00
Humidity = 36.00
Data added with count =5
Main Alarm fired!
Temperature = 30.00
Humidity = 36.00
Data added with count =6
Main Alarm fired!
Temperature = 31.00
Humidity = 36.00
Data added with count =7
Main Alarm fired!
Temperature = 33.00
Humidity = 35.00
Data added with count =8
Main Alarm fired!
Temperature = 32.00
Humidity = 33.00
Reached 7, will send data!
Parsed finalString =:25.00/34.00-:27.00/34.00-:28.00/36.00-:30.00/36.00-:31.00/36.00-:33.00/35.00-: 0.00/ 0.00-: 0.00/ 0.00-
Resetting array!
sent!
done!!

I think the issue I had here was that I wasnt clearing finalString properly because I got these results:

Parsed finalString =:30.00/37.00-:31.00/36.00-:32.00/33.00-:36.00/33.00-:37.00/32.00-:36.00/32.00-:33.00/34.00-:30.00/35.00-: 0.00/ 0.00-: 0.00/ 0.00-

Then its:

Parsed finalString =:30.00/37.00-:31.00/36.00-:32.00/33.00-:36.00/33.00-:37.00/32.00-:36.00/32.00-:33.00/34.00-:30.00/35.00-: 0.00/ 0.00-: 0.00/ 0.00-:28.00/33.00-:27.00/31.00-:27.00/31.00-:27.00/30.00-:26.00/30.00-:25.00/31.00-:25.00/32.00-:25.00/32.00-: 0.00/ 0.00-: 0.00/ 0.00-

And the third time its:

Parsed finalString
=:25.00/34.00-:27.00/34.00-:28.00/36.00-:30.00/36.00-:31.00/36.00-:33.00/35.00-: 0.00/ 0.00-: 0.00/ 0.00-

So I added the ****** line of code.

The only other thing I did was add some code to interact with the modem serial in order to see the responses. Is this what you meant JML?

well I meant don't use the SIM first, get the code to work reliably in the console, that is collecting and printing what it would send.

Also get rid of using the String class, just do a static buffer and use strcat and the other c library function to fill up the buffer with your data

stdlib.h
string.h

Your printRead() function is not great, it does not guarantee you'll be reading the full answer from the module because you might empty the Serial buffer faster than it fills in... See Serial Input Basics for more information on how to handle Serial

I ran that code without the SIM connected. I did it to make sure the code is working fine in term of alarms, variables etc.

Now I will run it with the SIM and see what results come back from the SIM. I fixed the finalString variable issue. Here are the results:

Alarm set!
Main Alarm fired!
Temperature = 30.00
Humidity = 28.00
Data added with count =1
Main Alarm fired!
Temperature = 29.00
Humidity = 27.00
Data added with count =2
Main Alarm fired!
Temperature = 29.00
Humidity = 33.00
Data added with count =3
Main Alarm fired!
Temperature = 29.00
Humidity = 39.00
Data added with count =4
Main Alarm fired!
Temperature = 28.00
Humidity = 42.00
Data added with count =5
Main Alarm fired!
Temperature = 28.00
Humidity = 42.00
Data added with count =6
Main Alarm fired!
Temperature = 28.00
Humidity = 41.00
Data added with count =7
Main Alarm fired!
Temperature = 28.00
Humidity = 41.00
Data added with count =8
Main Alarm fired!
Temperature = 27.00
Humidity = 41.00
Reached 7, will send data!
Parsed finalString =:30.00/28.00-:29.00/27.00-:29.00/33.00-:29.00/39.00-:28.00/42.00-:28.00/42.00-:28.00/41.00-:28.00/41.00-: 0.00/ 0.00-: 0.00/ 0.00-
Resetting array!
sent!
done!!
Main Alarm fired!
Temperature = 27.00
Humidity = 40.00
Data added with count =1
Main Alarm fired!
Temperature = 27.00
Humidity = 41.00
Data added with count =2
Main Alarm fired!
Temperature = 27.00
Humidity = 41.00
Data added with count =3
Main Alarm fired!
Temperature = 26.00
Humidity = 42.00
Data added with count =4
Main Alarm fired!
Temperature = 26.00
Humidity = 42.00
Data added with count =5
Main Alarm fired!
Temperature = 25.00
Humidity = 42.00
Data added with count =6
Main Alarm fired!
Temperature = 25.00
Humidity = 41.00
Data added with count =7
Main Alarm fired!
Temperature = 27.00
Humidity = 40.00
Data added with count =8
Main Alarm fired!
Temperature = 30.00
Humidity = 37.00
Reached 7, will send data!
Parsed finalString =:27.00/40.00-:27.00/41.00-:27.00/41.00-:26.00/42.00-:26.00/42.00-:25.00/42.00-:25.00/41.00-:27.00/40.00-: 0.00/ 0.00-: 0.00/ 0.00-
Resetting array!
sent!
done!!
Main Alarm fired!
Temperature = 32.00
Humidity = 36.00
Data added with count =1
Main Alarm fired!
Temperature = 32.00
Humidity = 32.00
Data added with count =2
Main Alarm fired!
Temperature = 32.00
Humidity = 32.00
Data added with count =3
Main Alarm fired!
Temperature = 33.00
Humidity = 32.00
Data added with count =4

ok I got it working so far...I guess the finalString was making it go haywire? Or a dubious upload. Here are the results:

Alarm set!
Main Alarm fired!
Temperature = 31.00
Humidity = 26.00
Data added with count =1
Main Alarm fired!
Temperature = 30.00
Humidity = 26.00
Data added with count =2
Main Alarm fired!
Temperature = 32.00
Humidity = 36.00
Data added with count =3
Main Alarm fired!
Temperature = 30.00
Humidity = 39.00
Data added with count =4
Main Alarm fired!
Temperature = 30.00
Humidity = 40.00
Data added with count =5
Main Alarm fired!
Temperature = 30.00
Humidity = 41.00
Data added with count =6
Main Alarm fired!
Temperature = 30.00
Humidity = 42.00
Data added with count =7
Main Alarm fired!
Temperature = 29.00
Humidity = 42.00
Data added with count =8
Main Alarm fired!
Temperature = 29.00
Humidity = 42.00
Reached 7, will send data!
Parsed finalString =:31.00/26.00-:30.00/26.00-:32.00/36.00-:30.00/39.00-:30.00/40.00-:30.00/41.00-:30.00/42.00-:29.00/42.00-: 0.00/ 0.00-: 0.00/ 0.00-
Resetting array!

RDY

+CFUN: 1

+CPIN: READY

+PACSP: 1
AT+CSCLK=0

OK
sent!
done!!
Main Alarm fired!
Temperature = 29.00
Humidity = 43.00
Data added with count =1
Main Alarm fired!
Temperature = 28.00
Humidity = 43.00
Data added with count =2
Main Alarm fired!
Temperature = 28.00
Humidity = 42.00
Data added with count =3
Main Alarm fired!
Temperature = 28.00
Humidity = 42.00
Data added with count =4
Main Alarm fired!
Temperature = 28.00
Humidity = 43.00
Data added with count =5
Main Alarm fired!
Temperature = 28.00
Humidity = 42.00
Data added with count =6
Main Alarm fired!
Temperature = 27.00
Humidity = 41.00
Data added with count =7
Main Alarm fired!
Temperature = 28.00
Humidity = 42.00
Data added with count =8
Main Alarm fired!
Temperature = 30.00
Humidity = 41.00
Reached 7, will send data!
Parsed finalString =:29.00/43.00-:28.00/43.00-:28.00/42.00-:28.00/42.00-:28.00/43.00-:28.00/42.00-:27.00/41.00-:28.00/42.00-: 0.00/ 0.00-: 0.00/ 0.00-
Resetting array!
AT+CMGF=1

OK
AT+CMGS="+50494505578"

:31.00/26.00-:30.00/
AT+CSCLK=0

OK
sent!
done!!
Main Alarm fired!
Temperature = 32.00
Humidity = 40.00
Data added with count =1
Main Alarm fired!
Temperature = 32.00
Humidity = 38.00
Data added with count =2
Main Alarm fired!
Temperature = 33.00
Humidity = 37.00
Data added with count =3
Main Alarm fired!
Temperature = 34.00
Humidity = 37.00
Data added with count =4
Main Alarm fired!
Temperature = 32.00
Humidity = 36.00
Data added with count =5
Main Alarm fired!
Temperature = 34.00
Humidity = 36.00
Data added with count =6
Main Alarm fired!
Temperature = 35.00
Humidity = 34.00
Data added with count =7
Main Alarm fired!
Temperature = 29.00
Humidity = 27.00
Data added with count =8
Main Alarm fired!
Temperature = 31.00
Humidity = 32.00
Reached 7, will send data!
Parsed finalString =:32.00/40.00-:32.00/38.00-:33.00/37.00-:34.00/37.00-:32.00/36.00-:34.00/36.00-:35.00/34.00-:29.00/27.00-: 0.00/ 0.00-: 0.00/ 0.00-
Resetting array!
AT+CMGF=1

OK
AT+CMGS="+50494505578"

:29.00/43.00-:28.00/
AT+CSCLK=0

OK
sent!
done!!