I've been working on this code for a week now and this is the first forum that I have signed up to in order to share the work I have done. I believe the code can still be improved on but I've not found many better and more reliable than the code I have written and I know how hard it is when you just want to find working code to get you going on your Arduino project
The code I have written saves the last phone number to text the SIM900 module into phoneNumber and the message they sent into messageBuffer.
If you wish to add the code as an external library then download the attachment to this post, place it in your "libraries" folder then include using the following code:
#include <TextReceiver.h>
SoftwareSerial SIM900(7, 8);
char phoneNumber[14];
char messageBuffer[128];
void setup() {
SIM900.begin(19200);
Serial.println("Ready!");
}
void loop() {
// UK mobile numbers are 13 in length (inc. '+')
textReceiver(13);
}
If you do not wish to use the external library for whatever reason an example is available which you can access by launching the Arduino app then navigating File > Examples > TextReceiver > TextReceiver
TextReceiver.zip (5.43 KB)