I’m having a hard time with encoders. Here’s a video explanation: http://screencast-o-matic.com/watch/cDXjF4j82n
Looking at the video, it looks like you are passing a parameter turn into the
enc_tgt() function.Can you tell us what you are passing through the parameter turn. As per our function definition, a target value in terms of number pulses to be moved has to be given in the place of turn, moreover it also looks like you are enabling both the motors, for the turn.
Please let us know if this helps,