Water breathing consists of a 4-second inhale followed by a 4-second exhale, repeated for 10-cycles.
There's nothing you can't do with a For-loop and a few If-statements.