Displaying the last text after receiving multiple texts over serial with enter command in between

Hi,
I need some help, please, in regard to displaying the last text after receiving multiple texts over serial with enter command in between,
I'm connecting a GSM module to an Arduino NANO by serial, and when I send an SMS from my mobile phone to the GSM, the response from the GSM to Arduino will be as below:

+CMT: "+6********","","22/06/29,15:11:03+40"<\r><\n> // Note: an Enter command generated
//from the GSM module
Hello world <\r><\n>

My inquiry is, how to display only " Hello world" and cancel out the previous text " +CMT:......"

Your assistance would be appreciated.
King regards.
Tony.

Hello Tonycham
Take a view here to gain the knowledge.

1 Like

Hi paulpaulson,
appreciated.
Is there another way for Arduino would detect the first ( ENTER) command, and display whatever next that ENTER??
Thanks.

If you are reading the input character by character, which would be obvious had you posted your sketch, then you could read characters until you receive a '\r' then display everything after that

1 Like

Hi UKHeliBob
I agree, is there any code to read characters until you receive an '\r' then display everything after that? Please.
That your answering would be greatly appreciated,
Thanks.

Start by posting your current sketch

This thing,


works really well for finding how to detect '\r'.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.