Moving in and out of a do while loop?

PaulS:
So, yes, you could use a while loop to execute functions over and over, exiting when a new IR event occurred. Simple call irrecv.decode() in the while loop, and break if it returns true.

You could change your loop function, too. Separate the test for, and decoding of, the IR event from the use of the decoded value.

In the cases where you want to do something only once, set results.value to 0. In the other cases, don't change results.value.

Then, each pass through loop, the action triggered by the last IR event will be repeated, unless the event value was changed to 0.

Honestly I didn't know what to use. If I separated the decoding and the if/else how would I know what pattern to do? Either I'd have a decoded IR signal with nothing to test it against or I'd have an if/else chain that wouldn't ever get activated.

(reference the irrecv.decode() in the loop) you mean like this?

while(results.value == 1)
{
    pattern1();
        if( irrecv.decode())
        {
            break;
        }
}

You could change your loop function, too. Separate the test for, and decoding of, the IR event from the use of the decoded value.

I think I know what you mean.

void loop()
{
        switch(irrecv.decode(&results))
            {
                case power:
                    power();
                    break;
            }
}

Or am I completely missing something?