/*
Nicolas Dall'O
nicolas.dallo.ap@gmail.com
This Arduino code is to be used with Android App: Arduino SMS
https://nicolasdalloap.jimdo.com/apps/arduino-sms-1-1/send-sms/
Send SMS from Arduino to Android phone via bluetooth
PLEASE READ FIRST
You need to send the phone number and the text in the following structure:
NUMBER/TEXT e.g: 1234/hello
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 BTserial(RXPin, TXPin);
bool text = false;
String SMStext;
String SMSnumber;
void setup()
{
Serial.begin(9600); // Set your Baud rate
BTserial.begin(9600); // Initialize the Bluetooth Module
while(!Serial)
{
// Wait for serial port to connect.
}
Serial.println("Enter phone number of SMS recipient");
}
void loop()
{
if (Serial.available())
{
if(text)
{
SMStext = Serial.readString();
// Send number and text to your phone
BTserial.print(SMSnumber + "/" + SMStext);
Serial.println("message sent");
Serial.println("Enter phone number of SMS recipient");
}
else
{
SMSnumber = Serial.readString();
Serial.println("Type SMS text");
}
text = !text;
}
}