Download Arduino Mega Pwm Pins Pictures. The arduino mega has in total one 3.3v pin and four 5v pins, which are able to provide a current up to 50 ma. In total the microcontroller has 54 digital i/o pins and 15 are able to produce a pwm signal.

Arduino Mega 2560 Pinout
Arduino Mega 2560 Pinout from www.electroschematics.com
Normally you do this with the analogwrite() command, however, you can access the atmel registers directly for finer control over the pwm on an arduino including changing the type. Note that the first line is equivalent. So for me it's very clear that the code is lacking something or making something wrong, and this should be caused by an issue in pwm initialization.

The vin power pin can also serve as power supply for also there are a bunch of digital pins available.

Do i need to disable serial on pins 0 and 1 to use them for pwm? Out of these 54 digital input / output pins fifteen are pwm (pulse width modulation) enabled pins. It has 54 digital input/output pins (of which 14 can be used as pwm outputs), 16 analog inputs, 4 uarts (hardware serial ports), a 16 mhz crystal oscillator, a usb connection, a power jack, an icsp header. The arduino mega 2560 has 15 pins which can be used for pwm output.