I am currently working on a project using SIM900 to control my AC unit through an IRLED light. Everything works fine except my consecutive incoming messages to the SIM900 just won't parse sometimes right after that successful receive-and-response. I have tried changing the baud range from 19200 down to 9600 on both the serial monitor and software serial but to no avail. I also timed the waiting time in between the same commanding message "STATE" which is about a minute until its started listening again, but my code just reluctant to parse the second commanding message "AcOff" not after sending it a few times. From my serial monitor, I can see the message is received but just cannot get parsed. It looked to me that it's purely a matter of chances my mega board and SIM900 would respond.
How do i know if my SIM900 and Mega board ready to parse my message? Attached is a copy of my project code. I appreciate your help and response.