As others have said, you should not pull d2 to 12 V. You are
sending about (12 V − 5 V) ÷ 100 Ω
= 70 mA into the high-side diode that protects that input pin.
This diode is only rated for 1 mA, thus you will likely fry it in a
To avoid the damage, you could increase the value of R1 in order to
lower that current to a safe value, but it would be simpler and safer to
completely remove the resistor and use the internal pullup instead, as
As for the measured output on d3, you expect 5 V when the pin is
HIGH. Your 1.5 V reading is suspicious. My guess is that
you forgot to
In this case, writing the pin to
HIGH does not have the expected
effect. Instead, it activates the internal pullup, which should make the
pin read 5 V, but then even a very small load (about 0.1 mA)
can make the voltage drop to 1.5 V.
If you are really getting 1.5 V while the pin mode is set to
OUTPUT, then you are really pulling far too much current from the pin.
My guess would be around 130 mA (a 26 Ω output resistance is
typical). The absolute maximum rating for the pin is 40 mA, so
again, you are going to fry something.