Periodically checks the state of each button and schedules the corresponding command if the button is pressed.