Voidugu:
Guys, can i use pwm to connect to ground?
For example, when i set pwm to be 0, can the pwm pin receive current? Can it be used to saturate a PNP BJT by acting as a ground for the transistor's base? If yes, how many mA can it handle as a ground?
First, the maximum current (flowing in either direction) that any Arduino pin (including a PWM pin) configured as an output can withstand without potentially damaging pin's internal circuitry is 40 mA, and it generally a good idea to keep the current 10 mA to 20 mA below that if you can. So put a resistor of at least 220 ? between the pin you are going to use and the transistor.
Second, to make any I/O pin low (i.e. have the same voltage as the Arduino's ground) you just set the pin to be an output with pinMode() and use the digitalWrite() function.