/*

PLEASE READ FIRST

The incoming structure is like this: NUMBER\nTEXT

You have to separate the number and the text.

Copy the code on your Arduino and start the Serial Monitor, then start the Arduino SMS App and connect your phone with your Bluetooth module.

HAVE FUN

*/

#include <SoftwareSerial.h>

 

const int RXPin = 10, TXPin = 8; 

SoftwareSerial mySerial(RXPin, TXPin); //take your RX and TX pin of your Bluetooth Module

String SMS, SMSnumber, SMStext;

void setup()

{

 Serial.begin(9600);

 mySerial.begin(9600);

}

void loop()

{

  if (mySerial.available())

  {

    SMS = mySerial.readString();

    SMSnumber = SMS.substring(0, (SMS.indexOf('\n')));

    SMStext = SMS.substring((SMS.indexOf('\n')+1), SMS.length());

    Serial.println("number: " + SMSnumber);

    Serial.println("text:   " + SMStext);

  }

}