Since D03 is not identified as an Analog pin, I tried to do digitalRead but I constantly get 0 readings (see figure below).
I then executed analogRead that returns 0-999 (digital pins return 4294967295 on both high and low digitalRead)… so I assume D03 is not a digital pin.
I tried identifying which pins can do digitalRead and the following is what I got so far:
D01
D02
D26
D27
D29
D12
D14
D16
D17
D18
D19
(I got compilation error using D20-D23)
Will it help if I place pullup resistors in those non-analog pins so I can get 1/0 digitalRead?
D03 works just fine in digitalRead mode.
Please refer to the pinout diagram for details on the modes supported by each pin. As you can see from that diagram, D20-D25 are not defined.
All D## pins support digitalRead and digitalWrite.
All A## pins support analogRead.
All pins marked with a small P support analogWrite.
There a few issues with your sketch. If you are not driving the input pin, then it ‘floats’ and can be either 0 or 1 at any time. You can call pinMode(WR0, INPUT_PULLUP); or pinMode(WR0, INPUT_PULLDOWN); to set the internal pull resistors, so that the input pin is no longer floating.
Calling analogRead on a non-analog pin results in undefined behavior.
Calling analogRead on a pin (that supports analogRead) changes that pin to analog mode. To call digitalRead on that same pin, you would need to switch it back to digital mode with a call to pinMode. Calling digitalRead on a pin that is not in a digital INPUT mode results in undefined behavior.
Running the following sketch with D02 wired to D03 produces and alternating 0/1 output.