Not sure how to start this sketch

I am needing to, I think, imbed loops, but not sure if that is the best approach. I am using an sms shield with a uno and will need to send and receive sms messages. Overall, an incoming message would activate or deactivate the alarm, and there would be functions that perform sensor polling and alarms, and send an sms when a sensor is high. Do I need to arrange an overall loop to constantly poll for the incoming sms and another loop for the sensors? I am not sure how to position the two or three needed loops, and if loops are the best way to do this. As I am thinking some delays will be used for the alarms, the delays might pose a problem(?).
Thanks in advance for any approach.

Take a look at Examples Communication SerialEvent.
It is not true event driven serial communication, but you probably be the first kid on the block to try it.
As the example shows, your loop() with combination of state machine would do exactly what you have in mind - scan thru the other devices, including serial message already processed by serialEvent and process their jobs as necessary. If you use mentioned example, your coding is 25 % done. Cool.
Good luck
Jim

Read Planning and Implementing an Arduino Program

Just as a quick example, here is the main loop from one of my medium-low complexity projects. (1882 lines of code.) This loop was written first, then the functions it calls were written. Then the functions below that level were written.

void loop() {
  readSensors();
  sendNMEA();
  sendVersion();
  readNMEA();
  doMenu();
  rawOutput();
}

Thanks for the "loop function" idea; interesting, but if I am excuting delays (the time length for an alarm output), how do I then answer an sms message to disable that alarm? I will pursue your suggestion.

nkuck:
Thanks for the "loop function" idea; interesting, but if I am excuting delays (the time length for an alarm output), how do I then answer an sms message to disable that alarm? I will pursue your suggestion.

The trick is not to ever waste time calling delay() (or any other busy-waiting function or code structure)

nkuck:
Thanks for the "loop function" idea; interesting, but if I am excuting delays (the time length for an alarm output), how do I then answer an sms message to disable that alarm? I will pursue your suggestion.

That is when you add state machine on top of the "loop functions" as I mentioned in my reply.
If you want I could send you one I am working on - in my spare time, or use "Blink without delay".
Jim

nkuck:
but if I am excuting delays (the time length for an alarm output),

If you study the code in the link in Reply #2 you will see that it uses millis() to manage timing without blocking - as in the BWoD example.

...R

Take a look at Examples Communication SerialEvent.

As SerialEvent() is not interrupt driven it is largely a waste of time using it. You may just as well check whether serial data is available using the Serial.available() function and act on it if there is something to process.

Robin2:
If you study the code in the link in Reply #2 you will see that it uses millis() to manage timing without blocking - as in the BWoD example.

...R

The key is realizing that a chip will never complain even if you ask "Are you ready yet? Are you ready yet? Are you ready yet? Are you ready yet?" 10,000 times a second.

UKHeliBob:
As SerialEvent() is not interrupt driven it is largely a waste of time using it. You may just as well check whether serial data is available using the Serial.available() function and act on it if there is something to process.

Agree and disagree.
It is not an interrupt and it is based on "available()" function already.
I would not call it waste of time since it physically removes the serial buffer processing from setup or loop.
It is a good example of separating / delegating tasks just like any other function.
( How may times we have seen posts - "running out of memory, how do I optimize my code? " where the answer was - use functions?)
Good fit for what the OP asked about. That' s all.
Jim

julyjim:
I would not call it waste of time since it physically removes the serial buffer processing from setup or loop.
It is a good example of separating / delegating tasks just like any other function.
( How may times we have seen posts - "running out of memory, how do I optimize my code? " where the answer was - use functions?)

Moving code into a function does not, of itself, have any impact on memory requirements and it may increase the number of CPU cycles required.

The examples in Serial Input Basics and in Planning and Implementing a Program make extensive use of functions - almost to the point of fetishism.

IMHO the principal reason for using functions is to help the programmer, not the Arduino.

The objection I have to serialEvent() is that it gives the false appearance that it is an interrupt driven process. It probably is in the Processing language from where the idea came. But it does not help the beginner with understanding the receipt of serial data in an Arduino.

…R