Good evening,
I've got some code for a project I'm working where I send a SMS when a piece of equipment has failed out in the field.
I am sending it to a single recipient at the moment but need to send it to multiple recipients. I thought about adding another line to enter a second number and so on but was not sure if it worked. I could try it but currently the Arduino is connected to the equipment and i cant get to it for a few days.
Here is the code I'm currently using:
#include <SoftwareSerial.h>
SoftwareSerial GPRS(8, 9);
boolean state, lastState;
void setup()
{
pinMode(2, INPUT_PULLUP);
state = digitalRead(2);
lastState = state;
GPRS.begin(9600);
Serial.begin(9600);
GPRS.println("AT+CMGF=1");
delay(1000);
}
void loop()
{
while(GPRS.available()) {
Serial.write(GPRS.read());
}
lastState = state;
state = digitalRead(2);
if ( state != lastState ) {
sendSMS();
}
delay(500);
}
void sendSMS() {
Serial.print("Equipment:XXXXXXX Location:XXXXXXX Status:");
Serial.println(state ? "STARTED" : "!!!STOPPED!!!");
GPRS.println("AT+CMGS="+44***********"");
delay(500);
GPRS.print("Equipment:XXXXXXX Location:XXXXXXX Status:");
GPRS.println(state ? "STARTED" : "!!!STOPPED!!!");
GPRS.write( 0x1a ); // ctrl+Z character
delay(500);
} [/color]
You kind input would be greatly appreciated!!