Вопрос в следующем.Приобрел 2 SIM900A mini перепрошил на SIM900 под нашу связь,заливаю скетч а он отказывается работать .С SIM900 Shield работает без проблем с этим скетчем ,а мини не хочет .Все перекопал в нете .нашел только то что библиотека <SoftwareSerial.h> с ним не работает .
Сам код
#include <SoftwareSerial.h> // Library for using serial communication
SoftwareSerial SIM900(7, 8); // Pins 7, 8 are used as used as software serial pins
String incomingData; // for storing incoming serial data
String message = ""; // A String for storing the message
int relay_pin1 = 2; // Initialized a pin for relay module
int relay_pin2= 3;
void setup()
{
Serial.begin(115200); // baudrate for serial monitor
SIM900.begin(115200); // baudrate for GSM shield
pinMode(relay_pin1, OUTPUT); // Setting erlay pin as output pin
pinMode(relay_pin2, OUTPUT);
digitalWrite(relay_pin1, HIGH); // Making relay pin initailly low
digitalWrite(relay_pin2, HIGH);
// set SMS mode to text mode
SIM900.print("AT+CMGF=1\r");
delay(100);
// set gsm module to tp show the output on serial out
SIM900.print("AT+CNMI=2,2,0,0,0\r");
delay(100);
}
void loop()
{
//Function for receiving sms
receive_message();
// if received command is to turn on relay
if(incomingData.indexOf("on1")>=0)
{
digitalWrite(relay_pin1, LOW);
message = "ON1";
// Send a sms back to confirm that the relay is turned on
send_message(message);
delay(9000);
digitalWrite(relay_pin1, HIGH);
}
// if received command is to turn on relay
if(incomingData.indexOf("on2")>=0)
{
digitalWrite(relay_pin2, LOW);
message = "ON2";
// Send a sms back to confirm that the relay is turned on
send_message(message);
delay(9000);
digitalWrite(relay_pin2, HIGH);
}
}
void receive_message()
{
if (SIM900.available() > 0)
{
incomingData = SIM900.readString(); // Get the data from the serial port.
Serial.print(incomingData);
delay(10);
}
}
void send_message(String message)
{
SIM900.println("AT+CMGF=1"); //Set the GSM Module in Text Mode
delay(100);
SIM900.println("AT+CMGS=\"+99999999999\""); // Replace it with your mobile number
delay(100);
SIM900.println(message); // The SMS text you want to send
delay(100);
SIM900.println((char)26); // ASCII code of CTRL+Z
delay(100);
SIM900.println();
delay(1000);
}