trying to add PIN function to code, having problems with 2D array pointer