Arduino mega PWM pins and pull up/down resistors.


I cant seem to understand if i need to use pull-up resistors on the Arduino mega pwm pins? I will be using them to drive pnp transistors, so the active (open) state of the transistor is when the pin is low. I will be using the analog output pins for pwm as well as just high and low (so 0V and 5V) signals.

Thank you.

I don't think pull-up resistors are relevant for pins in OUTPUT mode - the pins are positively driven high or low.

I would suggest 10k (or some other higher value) pullDOWN resistors.

Resistors not needed. Outputs are actively driven High and Low.
The only time of concern is during reset when all pins are inputs. If you want a specific level, then use a 5K to 10K pullup to keep the PNP off if desired. Or a pulldown if you want it on.

Analog pins can be treated just like digital pins with
digitalWrite(pinX, HIGH); //or LOW

byte pinX = A0;
altho I prefer using the digital pin number - A0 = 21 on a Mega. Or 22? Not sure, never actually used a Mega, and haven’t looked at pins_arduino.h in a while.