added cap threshold for each pin, removed bounce counter