Sending Updated Sensor Values in SMS

Hi there!

I'm using Arduino UNO, TinySine 3G GSM shield and a sensor (output values 0-1000). I'm able to send a pre-defined SMS to my mobile but how can I send the current value of the sensor in the SMS?

int sensorValue = analogRead(A0);
float val= map (sensorValue, 122, 613, 0, 1023);
 if(val > 500)
     { 
      
      fona.sendSMS("0xxxxxxxx", "CAUTION");// command to send SMS
      
     }

I used FONA 3G GSM library

You need to build a char array with the message in it and put that where you have the string "CAUTION" now.

http://www.cprogramming.com/tutorial/c/lesson9.html

Thank you so much for your quick and valuable response. I will work on it.

This worked for me. Now I can see the current sensor values in my SMS.

 char buffer[24];
          char r[10];
          int sensorValue = analogRead(A0);
          float val= map (sensorValue, 122, 613, 0, 1000);
          dtostrf(val, 3, 2, r);
          sprintf(buffer, "%s High Level", r);
   
          if(val > 350)
           { 
      
              fona.sendSMS("0xxxxxxx", buffer);
      
            }
          int sensorValue = analogRead(A0);
          float val= map (sensorValue, 122, 613, 0, 1000);
          dtostrf(val, 3, 2, r);

The analogRead() function returns an int. The map() function takes an integer value (a long, actually) and returns an integer value (a long, actually). It makes NO sense to store the integer value in a float variable and then pretend that printing two decimal places makes any sense.