Arduino UNO: Internal pull up for D0(RxD) and D1(TxD)

Currently I am using Arduino UNO which is using ATMega328. My design require plenty of IOs which forced me to use D0 and D1 and trigger input.

On the UNO Rev 3 board. The D0 and D1 are also connected to RxD and TxD on hardware. Configured both as input pins. I tried to place and external 10k pull up to both, used a tact switch to turn it low when pressed. This works find, however, it affected the programming. I need to disconnect the D0(RxD) whenever I need to program the UNO board. Else, there will be a always High on RxD which affect this.

My basic purpose is to get this port works as a switch input, whether active high or low. I remember previous I turned on the internal pull up but doesn't work as well.

Does anyway one has experience using D0 or D1 as input?

I’m not too sure what you mean when you say “I turned on the internal pull up but doesn’t work as well.”

If you mean then the switch input doesn’t work then I suspect you may have it wired up wrong because there should be no difference from any other GIO pin.

If you mean that it stops the serial communication working then I suggest (with the pin set to INPUT):

Disable interrupts
Write pin HIGH
Read switch state
Write pin LOW
Reenable interrupts

Should, hopefully, not disrupt the comparatively slow serial handling, at least on the Arduino end. Might still confuse the PC but the pulses will be very short.

Obviously, if you are operating the switch while attempting to use serial communication then you are still going to have trouble.