I am trying to feed a NPN transistor output to pin 2 on the UNO. The transistors base pin is connected to a switch, I used a sime interrupt sketch from the arduino web page, now the strangest thing happens, when I press the button the on board LED (on the UNO board) glows but when I release the button the led does not go off but slowly fades like as if there was PWM with reducing duty cycle. I am puzzles to why this happens and nothing comes to my mind. Any help?
You need to provide a diagram or photo of the whole circuit, or describe it in full detail (photo
is usually quicker/easier!).
Offhand it sounds like you don't have a good pull-up so the pin is floating when the transistor is