hello there, i've been working on this..when motion is detected, then GSM will send message..but is not working..please help me..
#include "SIM900.h"
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
String outMessage = "you left your child in your car";
String destinationNumber = "+xxxxxxxxxxx";
const int led_pin = 5;
const int sensor_pin = 7;
int sensor_value;
void setup() {
pinMode(led_pin, OUTPUT);
pinMode(sensor_pin,INPUT);
}
void SIM900power()
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
}
SIM900.begin(19200);
delay(20000);
SIM900.print("AT+CMGF=1\r");
delay(100);
SIM900.println("AT+CMGS = "" + destinationNumber + """);
delay (100);
SIM900.println(outMessage);
delay(100);
SIM900.println((char)26);
delay(100);
}
void loop() {
sensor_value = digitalRead(sensor_pin);
if (sensor_value == 1){
digitalWrite(led_pin, HIGH);
delay(1000);
digitalWrite(led_pin, LOW);
}
}