Grovepi with grove encoder

Hi,

The firmware version that I have in the GrovePi+ board. - version 1.2.2
Other sensors Relay, Electromagnets, Sound sensor and all works fine
But while using “Python/grove_encoder_read.py”, I am receiving value 255 even when I change encoder position.
Another question is how can i change the grove port instead of D2.

Here is the code:

import time
import grovepi
import atexit

atexit.register(grovepi.encoder_dis)

print "Reading from the encoder"
grovepi.encoder_en()
while True:
    try:
		[new_val,encoder_val] = grovepi.encoderRead()
		if new_val:
			print encoder_val
		time.sleep(.5) 

    except IOError:
        print ("Error")

Hey,
Can you have a look at this http://www.dexterindustries.com/topic/grove-encoder-with-grovepi/#post-61554 and try it out and let us know if it helps.

-Karan