Ive got my arduino uno counting periodic pulses in an integer. When it hits pre-determined figures it sends me a SMS. The problem is that while it is sending this it cannot do anything else and if there is a pulse at this time it will not see it.
Does anyone know how I can get it to still count while it is sending a message?
using pins 4 and 13 only for the count
Arduino Uno & Tinysine GSM shield
Thanks! (sorry but I dont want to post my whole sketch on here)
I've done something similar recently.
When you send +CMGS, and wait for the > prompt... don't wait for the >.
Set a flag for yourself, then when >is received - send the message body (CTRL-Z) - and return again to your main process.
Then... again don't wait for +CMGS: OK/ERROR, but do the same thing... set a flag, and return.
Finally, when +CMGS: OK/ERROR is received - you can mark the message as 'sent' - or manage your retry strategy if necessary.
To do all this - you need to understand the principles behind Blink Without Delay - so that you can keep an eye open for serial messages and timeout of the modem (no response etc) while your main tasks are running.
You may like to use a state machine to manage the steps - but start simple if that's what you need, then work it up to all the bells and whistles!
and please don't use the String class! Use char[] arrays - it will serve you much better in the long run!