We can explain the 17 mA that I measured on D1, because if the LED had a 1.9V voltage drop, then I = (5 - 1.9) / 150 which gives about 20 mA. Close enough. And this is because once you initialize the serial port, it is the job of the UART to keep the Tx line high unless it is sending something.

But what about the Rx line? (D0). That's an input, right? Well it's an input on the Atmega328, but an output on the Atmega8U2 USB interface chip. However it goes through a 1K resistor before hitting D0. Now the Atmega8U2 doesn't know whether or not the "main" chip is listening for serial data, so it has to keep that pin high (M8TXD). So, I = (5 - 1.9) / (1000 + 150) giving 2.7 mA.

Now since I measured 2.67 mA going through the LED that agrees exactly with the theory.

But what if you set the pinMode? Doesn't that override the USART? Well, no. According to page 197 of the datasheet:

Quote

Bit 4 - RXENn: Receiver Enable n

Writing this bit to one enables the USART Receiver. The Receiver will override normal port operation for the RxDn pin when enabled.

Bit 3 - TXENn: Transmitter Enable n

Writing this bit to one enables the USART Transmitter. The Transmitter will override normal port operation for the TxDn pin when enabled.

So in other words, once you enable serial comms, the "normal operation" of D0 and D1 is overridden.

And even if you don't, you have to contend with D1 being driven high by the Atmega8U2 chip (through the 1K resistor).

Please post technical questions on the forum, not by personal message. Thanks!