i only need the "wait until" code.
Testing whether an input is HIGH or LOW using if would seem to be useful