An electronic pen for interacting with a substrate having coded data disposed thereon. The pen comprises: an image sensor for sensing the coded data when the pen is used to interact with the surface; a slidably retractable nib for contacting the surface; a processor configured to generate indicating data indicative of the interaction with the substrate; and communication means for communicating the indicating data to a computer system. The image sensor is configured to sense the coded data only when the nib is configured in the extended position.