Hi,
I have a mega2560, where the digital output 13 (PWM) is hooked through a resistor to a NPN transistor to control the ground arm of a DC fan.
For some reason, during uploading of code to the arduino or opening the serial monitor there's some output on this pin that causes the fan to start momentarily if I have the DC power to it on.
During normal serial comms, this doesn't happen, but I'm only sending single char messages so they might be too short.
I checked and it seems that pin 13 isn't related to any TX/RX function on the mega.
The sketch is working as I expect and I can control the fan speed normally.
Do I need a pull-down resistor on the output to prevent this? Or do all the PWM outputs just go nuts during an upload?