Check this code,it can help you, I sent some SMS by it.
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
void setup()
{
SIM900.begin(19200);
SIM900power();
delay(20000); // give time to log on to network.
}
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
}
void sendSMS()
{
SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message
delay(100);
SIM900.println("AT + CMGS = \"+21267315xxxx\""); // recipient's mobile number, in international format
delay(100);
SIM900.println("Hello ^^"); // message to send
delay(100);
SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(100);
SIM900.println();
delay(5000); // give module time to send SMS
SIM900power(); // turn off module
}
void loop()
{
sendSMS();
do {} while (1);
}
I have problem, I used the example in library send sms, and in the serial monitor just appear Send sms messages, I waiting, and there is nothing happen,,
I am new in arduino user, please help....
thanks before
I use the icomsat 1.1 as the shield,, I hve just bought it two days ago,, what is the shield you use?
also,, I hve tried the other gsm example in library, like receive, make call, check modem, gsprs,, and problem is same
Help please...
The I/O, I just plug on the arduino uno
I have tried using the other tutorial which for sim900,, but itssame
I am new i arduino user, so I learning about that,,
They are the ones you selected with the jumpers. You can select any pair from D0 to D7, just change the software to reflect this. Unless you have good reason to, never use D0 & D1 because the hardware serial uses these pins, meaning Serial Monitor won't work.
Hai
I'm also using icomsat 1.1 with arduino uno and follow this thread. After i read this article then i try, but it still cannot send sms by this code? why is it happen? can you help me dannable? i'm using krikho1994s code anyway.
now i'm using software arduino 1.6.4. when i compiled it, it attach to the arduino. when open serial monitor nothing happen although there is nothing error.
#include <SoftwareSerial.h>
SoftwareSerial SIM900(6, 7);
void setup()
{
SIM900.begin(19200);
SIM900power();
delay(20000); // give time to log on to network.
}
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
}
void sendSMS()
{
SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message
delay(100);
SIM900.println("AT + CMGS = \"+6289638777223\""); // recipient's mobile number, in international format
delay(100);
SIM900.println("Hello ^^"); // message to send
delay(100);
SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(100);
SIM900.println();
delay(5000); // give module time to send SMS
SIM900power(); // turn off module
}
void loop()
{
sendSMS();
do {} while (1);
}
well i do have same issue right here. i work on this code, which exactly the same with the example given by krikho. I only change the software serial pins into 2,3 (i already matched it with I/O pins on my SIM900) dannable said that it is okay since not using 1 and 0
#include <SoftwareSerial.h>
SoftwareSerial SIM900(2, 3);
void setup()
{
SIM900.begin(19200);
SIM900power();
delay(20000); // give time to log on to network.
}
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
}
void sendSMS()
{
SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message
delay(1000);
SIM900.println("AT + CMGS = \"+628569xxxxx\""); // recipient's mobile number, in international format
delay(1000);
SIM900.println("Hello, world. This is a text message from an Arduino Uno."); // message to send
delay(1000);
SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(1000);
SIM900.println();
delay(5000); // give module time to send SMS
}
void loop()
{
sendSMS();
do {} while (1);
}
done with the compiling, i uploaded the code to board. and nothing happened.
This code supposed to automatically turned ON the shield, isn't it? Since there is SIM900power() inside the code. But my shield still turned OFF. I still have to press the power button to turn it ON. I also used external adapter just in case the current was'nt enough from the USB. But nothing changed.
The following works for me. Txd jumper on 2, Rxd on 3, slide switch to 'UART'. Note the additional declaration of the powerPin as OUTPUT.
#include <SoftwareSerial.h>
#define powerPin 9
SoftwareSerial SIM900(2, 3);
void setup()
{
pinMode(powerPin,OUTPUT);
digitalWrite(powerPin,LOW);
SIM900.begin(19200);
SIM900power();
delay(20000); // give time to log on to network.
}
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(powerPin, HIGH);
delay(1000);
digitalWrite(powerPin, LOW);
delay(5000);
}
void sendSMS()
{
SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message
delay(1000);
SIM900.println("AT + CMGS = \"+447751123456\""); // recipient's mobile number, in international format
delay(1000);
SIM900.println("Hello, world. This is a text message from an Arduino Uno."); // message to send
delay(1000);
SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(1000);
SIM900.println();
delay(5000); // give module time to send SMS
}
void loop()
{
sendSMS();
do {
}
while (1);
}