// LightsWentOutAlart void setup() { Serial1.begin(19200); Serial.begin(9600); SIM900powerUpOrDown(); delay(20000); // give time to log on to network. } void SIM900powerUpOrDown() { pinMode(9, OUTPUT); digitalWrite(9,LOW); delay(1000); digitalWrite(9,HIGH); delay(2000); digitalWrite(9,LOW); delay(3000); } void SendSMS() { Serial1.print("AT+CMGF=1\r"); //Because we want to send the SMS in text mode delay(100); Serial1.println("AT + CMGS = \"+393338309783\"");//send sms message, be careful need to add a country code before the cellphone number delay(100); Serial1.println("Alert by Edison. Lights Went Out at home!");//the content of the message delay(100); Serial1.println((char)26);//the ASCII code of the ctrl+z is 26 delay(100); Serial1.println(); } void loop() { int sensorValue = analogRead(A0); Serial.println(sensorValue); if(sensorValue < 500){ SendSMS(); delay(600000); } delay(1); }