Sim800f measure signal strength and sms it

In my app i want to count the signal strenth of a SIM800F shield in Arduino [with 4G] and then send it via SMS in my smartphone.
I use AT command AT+CSQ and I see ok the answer in my Serial port.

*#include "SIM900.h"*
*#include "sms.h"*
*#include "call.h"*
*SMSGSM sms;*
*CallGSM Call;*
boolean started=false;
char incomingByte; 
char inputString[24];
byte proth_fora=0;
char s1=" "; char s2=" ";

void setup() {
  Serial.begin(9600);
  //SIM800F Begin kai Setup
    if (gsm.begin(9600)){
          Serial.println("\nstatus=READY");
           gsm.SimpleWriteln("AT+CMGD=1,1"); // delete all SMS 
          started=true;
         }
     else {
          Serial.println("\nstatus=IDLE");
     }   
}
void loop() {
  serialFlush();
  delay(1500);
  **gsm.SimpleWriteln("AT+CSQ");** 
    delay(100); byte i=0;
    while(gsm.available() and (proth_fora==0)){
      incomingByte = gsm.read();
      Serial.print(incomingByte);Serial.println(i);delay(1000);
      inputString[i]= incomingByte; 
      i=i+1;
    }
    delay(10000);
    proth_fora=1;
    //Serial.println(inputString);
    Serial.print(inputString[14]);Serial.println(inputString[15]); delay(7000);
    s1 = inputString[14]; 
    s2 = inputString[15];
    Serial.print("--------");
    Serial.print(s1);delay(3000);
    Serial.println(s2)
}
// CLEAR SERIAL PORT DATA
void serialFlush(){
  while(gsm.available() > 0) {
    char gsp_port = gsm.read(); 
  }
}

As you see above [red lines] when the programm runs i get the answer in serial port with char14 and char15 [the 1 and 7] which means that the signal is 17 now [0-31 is the zone].
I put the characters in s1 and s2 and again i see the 17 not as number but as a string [blue circle]. But when i try to convert the 1 and 7 to integer with atoi(), i get 0 and 0.
I want to send this values with SMS. The library i use says


SMS FUNCTIONS in SMS class.
It's need to create a class object for SMS class with SMS sms_obj_name (in the examples it's used SMS sms)
In the examples, to call a function the code is: sms.function_name();

char SendSMS(char * number_str, char message_str);
Send a SMS to the specified number with the specified string.
*

so i try this that works in another point of my app with int values:
byte ora;
byte lepto;
char time_data[30];
char* behind(char* buff) {
return buff + strlen(buff);
}
...
...
strcpy_P(time_data, PSTR("HOUR= "));
dtostrf(ora, 2, 0, behind(time_data));
strcat_P(time_data, PSTR(": MINUTE= "));
dtostrf(lepto, 2, 0, behind(time_data));
if (sms.SendSMS(number, time_data));

How to contnue so to get two integers one for each digit and send them as one number with SMS? I tried atoi() and gives 0.
Can i use the char variables s1 and s2 to put them at the end of time_data[30]?

Thank you for your time

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.