ahmedragia21
Member
Hi, im trying to interface a uC to a GSM Mobile phone , i wanna read the 1st unread msg from the cell phone , the problem is my codes it waits for the string with \r , the problem is when there is no msg the uC halts at the gets() cuz it needs a string with \r , i dont know how to solve this ..
Code:
puts("AT+CMGL=\"ALL\"\r\n");
// skips 11 strings
// when there is no msg , the uC halts here waiting for any string and it terminates with \r
// i wanna solve this and when there is no msg , it should skip all these gets
gets(array,10);
gets(array,10);
gets(array,10);
gets(array,10);
gets(array,10);
gets(array,10);
gets(array,10);
gets(array,10);
gets(array,10);
gets(array,10);
gets(array,10);
// here is the msg
gets(array,5);