PWM & TX/RX pins as Inputs on MEGA 2560 R3

Hello,i need a lots of digital inputs on an arduino Mega.
I've used all digital i/o and analog inputs pin, and i'd like to use even pwm and communication pins

Is possibile to use Analogread() or Digitalread() on MEGA pwm and comunication pins?
Is there any other way to do this?

thank you see ya from Italy

PWM pins are just like every other digital pin but have the extra to output PWM via hardware. Some for the analog pins, they work as digital in pin just fine but have the extra to read analog voltages.

Some goes for the serial ports, they have the extra to be able to do hardware serial. As long as you don't call Serialx.begin() you can use them for digital IO just fine (so digitalRead() and digitalWrite just like every port). An exeption is the first serial (Serial1). That one is connected to the onboard serial to USB converter. So if you can spare two pins just leave them unconnected.

If you need an extra pin you can use the Rx pin as output but be aware this pin gets switched while programming etc. Input is possible as well but the internal pullups don't work and you can get some problems while programming if you force this pin into a state.

The Tx pin can be used as well but be aware this pin is a output while programming. If you force this into a state (with a switch or something) programming will fail. This pin is gets switched will programming as well.