Help with Arduino program

PaulS's code sample is good, although you should put his code in a function and call it once every few tens of ms, otherwise the mode change will be so fast you'll end up with a random selection.

Also, see "blink without delay" example to get rid of those nasty delay()s :stuck_out_tongue: