0

Usually GPRS modules (SIM800,900, A6, etc) that used with arduino are called in synchronous way in HTTP (GET/POST) request. It takes more than 10 seconds in most times and this makes the system very slow. Is there a way to use them (libraries or the module) asynchronously (or is there any alternatives) and perform these request in background while main business is being done?

0

Sure there is. All you're doing is reading and writing serial data. All you have to do is learn how to do that without blocking.

Most code I see bandied around is of the form:

Send AT command
Delay for numerous seconds
Read and discard anything that might be there
Send another AT command
Delay for more seconds
Read and discard anything that might be there
... etc ...

That is completely the wrong way to do things.

Instead you should be using non-blocking reading to look for an actual OK response from the AT commands that you have sent and use that to progress through the different stages of a Finite State Machine.

Some reading resources from my blog:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.