read input from pin