analog in pins

Hello, i have 2 questions: 1) i have arduino mega 2560, the pwm pins are digital pins too? 2) i didnt plug the analog in pins to nothing and when im measure the voltage there in labview its jumping up and down between 1.5 to 2, is that ok? lets say i will plug there 4v so it will stable and show 4v on labview?

Thank you,

1) Both Pwm and analog pins can be used as digital pins.

2) those pins are"floating" that's why it's often suggested to ground unused pins.

So when i will plug to the analog in pins 4v it will stable and show 4v on labview?

Thanks,

Yes they will work fine when connected

There is a difference between the pins that are used by analogWrite() and analogRead(). All the pins can be used for digital I/O.

Make sure a pin is set to pinMode(pin, INPUT); if you want to apply an external voltage to the pin. Otherwise you risk passing too much current through the pin - the absolute max is 40mA.

...R