AT commands

  • Thread starter Thread starter weird0
  • Start date Start date
W

weird0

// AT+CMGS sends the SMS message

I wish to send the above AT command on the serial port but how should
i write the string for it
which is

"AT+CMGS=+03222345432
Hello World"

temp =@"""AT+CMGS="+03222476927""" + "\n" + " > " + msg ;
// Here the compiler gives an error
 
weird0 said:
// AT+CMGS sends the SMS message

I wish to send the above AT command on the serial port but how should
i write the string for it
which is

"AT+CMGS=+03222345432

temp =@"""AT+CMGS="+03222476927""" + "\n" + " > " + msg ;
// Here the compiler gives an error

Whenever you post a question due to an error (whether it's a compiler
error or an exception) it's worth saying what the error is.

In this case it looks like you've got a stray quote after the CMGS=
part. If you change it to

temp =@"""AT+CMGS=+03222476927""" + "\n" + " > " + msg ;

it will compile. However, you'll then not quite match your desired
output - you'll still have one quote too many in the output. Try

temp =@"""AT+CMGS=+03222476927" + "\n" + " > " + msg;

or the simpler (IMO):

temp = "\"AT+CMGS=+03222476927\n > " + msg;

I don't think using a verbatim string literal actually helps in this
case.
 
// Here the compiler gives an error

Is there any reason why you have posted in a technical newsgroup saying that
you're getting an error, but have not actually said what the error is...?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top