abstraction for looping using physical button presses