239Views9Replies

Author Options:

hye everybody.. im new in Arduino.. i want to make a program which can print value of AT+COPS? as a sms body? Answered

Actually AT+COPS? will return an available network and i want to make the available network from AT+COPS? as sms or message body.
here is a code that i try but it is not working

Serial.println("AT+COPS?");
if (Serial.available())
{
     Serial.println(AT+COPS?);      // This is a sms body that will print the network available
}

9 Replies

user
steveastroukBest Answer (author)2010-05-25

Does your hardware work, so you CAN get comms to the phone ? What interface are you using ?

Select as Best AnswerUndo Best Answer

user
teddycute (author)steveastrouk2010-05-25

 yes. my hardware are working and i can get the comms to the phone (just work when i send simple message such as "Hello") but i cannot get the available network as the message to send via phone.
im using Arduino Duemilanove. what do you mean by interface?

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)teddycute2010-05-25

How does the phone connect to the Arduino. The connection is called an interface.

So you can send AT commands to the phone  ?

Your code sends "AT +COPS" and should then wait and READ the reply from the phone. Your code has no read command

Select as Best AnswerUndo Best Answer

user
teddycute (author)steveastrouk2010-05-26

 is it something like this?

void setup()
{
  pinMode(led, OUTPUT);
  pinMode(onModulePin, OUTPUT);
  Serial.begin(115200;
  Serial.println("AT+CMGF=1");
}

void sms()
{
  Serial.println("AT+COPS?");
  if (Serial.available())
  {
     msg = Serial.read();
  }
}
void loop()
{
  while (count < timesToSend)
  {
     delay(1000);
     Serial.print("AT+CMGS=")
     Serial.print(34,BYTE);
     Serial.print("**********");      // where ********** is the phone number
     Serial.println(34,BYTE);
     Serial.print(msg);                // the sms body that will send message of the                                                       // available network
     Serial.println(0x1A,BYTE);

     count++;
}
if (count == timesToSend)
{
   Serial.println("AT+PSCPOF");
   count++;
}
}

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)teddycute2010-05-26

What HARDWARE are you using to talk to the phone ? Are you tying up the serial port on the Arduino, or have we got something we can use as a debug port ? 

Can you talk to the phone at all ? 

I would want to see the message from the phone after
{
  Serial.println("AT+COPS?");
  if (Serial.available())
  {
     msg = Serial.read();

  }

Select as Best AnswerUndo Best Answer

user
teddycute (author)steveastrouk2010-05-26

- im using Sagem Communication MODULE Hilo (GSM Module).

-i already can make a missed call and send a simple message to the phone.

- the above coding maybe not working because i got nothing message from the phone..


Select as Best AnswerUndo Best Answer

user
steveastrouk (author)teddycute2010-05-26

What does the manual say about the at+cops command ? There are only approximate standards for the AT commands.

Select as Best AnswerUndo Best Answer

user
teddycute (author)teddycute2010-05-26

 can you help me to correct the coding if there are any errors..
the above coding actually will send an empty message..
thanks a lot for the help

Select as Best AnswerUndo Best Answer

user
teddycute (author)teddycute2010-05-25