Add toggle feature. Alternate between outputmax and outputmin when input equals inputmax