After uploading this sketch, my LED on port 2 ( or when testing it on 1 or even 0), a small glow is emitted from the LED's, when is should be completely inactive. This pins are constantly giving current.
You have the terms Anode and Cathode swapped.
Anode has long leg, cathode has short leg and the flat spot on the LED body.
I can't explain the glow.
Does it do that on other output pins as well? Or just D2?
It does that for pins 0, 1 and 2. All the other pins are working as expected.
Also, when using these pins, I'm getting no serial print messages at all.
But when using all other pins, everything is working well, plus, any serial messages work fine.
(Yes, just realised the previous confusion - thanks!)
zapdez:
It does that for pins 0, 1 and 2. All the other pins are working as expected.
Also, when using these pins, I'm getting no serial print messages at all.
But when using all other pins, everything is working well, plus, any serial messages work fine.
(Yes, just realised the previous confusion - thanks!)
"Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output."
0 will be pulled up no matter what, since that's connected, through a resistor, to the tx line of the serial adapter. Idle serial line is high, so pin 0 will be high unless driven otherwise. But driving the pin low should definitely stop the glow.
Do you have a multimeter? Measure voltage on the pin from ground, then disconnect the LED and measure again.