implement digitalRead(pin) and analogRead(pin)