Pages: [1]   Go Down
Author Topic: Transmitting SMS from a GSM modem  (Read 552 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

Ive got an project going on bout trying to send an text-message from my arduino to my mobile-phone using an GSM. The program im now using is this:
Code:
#include <SoftwareSerial.h>

SoftwareSerial cell(2, 3); // RX, TX
char mobilenumber[]="99497322";  // Replace xxxxxxxx with the recipient's mobile number
char textmessage[160]; // used to hold contents of message to send
int b=0;
void setup()
{  //Initialize serial ports for communication.
cell.begin(9600);
delay(35000); // give the GSM module time to initialise, locate network etc.
// this delay time varies. Use example 26.1 sketch to measure the amount
// of time from board reset to SIND: 4, then add five seconds just in case
pinMode(13, OUTPUT); // use the LED for status
randomSeed(analogRead(0));
}
void startSMS()
// function to send a text message
{
digitalWrite(13, HIGH);
cell.println("AT+CMGF=1"); // set SMS mode to text
cell.print("AT+CMGS=");
cell.print("AT+CSCA=+4790002100");
cell.write((byte)34); // ASCII equivalent of "
cell.print(mobilenumber);
cell.write((byte)34);  // ASCII equivalent of " HOME MADE.
delay(500); // give the module some thinking time
}
void endSMS()
{
cell.write((byte)26);  // ASCII equivalent of Ctrl-Z
delay(15000); // the SMS module needs time to return to OK status
digitalWrite(13, LOW);
}
void loop()
{
b=random(0, 99);
for (int a=0; a<100; a++)
{
if (a==b)
{
startSMS();
cell.print("The random number is: ");
cell.print(b);
endSMS();
}
}
do
{
delay(1);
} while (1>0);
}
And I got som problem with getting it working, hope that someone maybe would be able to help me smiley-wink


Moderator edit: CODE TAGS
« Last Edit: November 13, 2012, 08:49:08 am by AWOL » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26324
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
And I got som problem
...and?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Queens, New York
Offline Offline
Faraday Member
**
Karma: 99
Posts: 3632
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

does the mobile number need to have 9+ 949-7322, or does it need area code 9+(XXX) 949-7322 ?
your original number: 99497322

What problems are you getting?
Logged

Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

Pages: [1]   Go Up
Jump to: