How can I digitalRead a pin that is in pinMode OUTPUT?

In this case you just want to access the data register itself.

PORTB and PORTD registers contain the pin data you are looking for. I finally got access to an Arduino to figure it out. You want to use bitRead(PORTD, pin).

Serial.println(bitRead(PORTD,3)); //Reads bit 3 of register PORTD which contains the current state (high/low) of pin 3.

Reference Bit Read Operation for more information.

Leave a Comment