How connect a rotary encoder