stock or Receive reply of AT command by SMS from Arduino

Thread Starter

wallwell

Joined Oct 28, 2017
5
Hi

I am using Arduino UNO with a shield for AT commands.
I am trying to receive an SMS on my cellphone containing the reply of the AT commands sent by the cellular device.
Fot exemple, I would like to receive the "OK" reply in SMS on my cellphone when my arduino code has the "AT" or Serial.print("AT") AT command inside it.
The problem when I do Serial.print("AT") is that I only receive "AT" without OK in the SMS.
Could you tell me how I could do it ? is there an exemple?

Thank you
 
Last edited:

be80be

Joined Jul 5, 2008
1,967
You have to print both parts you only printing AT you need to print the in coming data which would be the OK
Code:
void loop() {

        // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                // say what you got:
                Serial.print("I received: ");
                Serial.println(incomingByte, DEC);
        }
}
you'll have to look up how to format the incomming byte i think you use
Serial.println(incomingByte, "");
 

Picbuster

Joined Dec 2, 2013
987
what about device echo?
you send AT [CR] with echo you receive AT [CR] OK [CR] but the first read will deliver AT[CR]
Without echo you receive an expected answer ( this could take some time).
Normal practice is to start with disable echo command ( see manual something like ATE=0 ).
I don't know how arduino lib is handling input but I expect that is will use interrupts and not a (silly) looping mechanism to get data.

Picbuster
 

Picbuster

Joined Dec 2, 2013
987
That implies that the appli is waiting until time out for data.( all other processes are waiting also unless it's multi tasking and one task is collecting data).
It's a way of working.
Picbuster
 
Top