Hello again my arduino friends!! According to a library i found i've written a code for a simple project. All i need is : in an industrial board when the power is off,arduino sends a message to the user that warns him that the power is off. I want you to see the code and tell me if is correct or not. I use a library that i found in Internet for the gsm sim900.
The code is:
#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;
boolean started=false;
int board1 = 7;
void setup()
{
//Serial connection.
Serial.begin(9600);
pinMode(board1, INPUT);
Serial.println("GSM Shield testing.");
if (gsm.begin(2400)){
Serial.println("\nstatus=READY");
started=true;
}
else Serial.println("\nstatus=IDLE");
if(started){
if (sms.SendSMS("+30693xxxxxxx", "SMS from Arduino OK."))
Serial.println("\nSMS sent OK");
}
};
void loop()
{
int buttonState = digitalRead(board1);
if (board1=LOW)
sms.SendSMS("+306932xxxxxxx", "board1 is off");
}
Can anybody please tell me if is the code correct??If not what can i change so it will work properly??I think it is a simple project but my programming skill is low cause i am a beginner. Thank you in advance.