I just bought an Arduino and started playing with it.
My issue is that analog and digital value seems totally crazy when I plug a wire into the hole.
The wire is a simple 5 cm long wire that ends in the air. It is NOT connected to any electronic devices.
I understand that there are pertubations and noise in the air, but I cannot believe they are 5 V high...
What you are seeing is perfectly normal, a 'floating input pin' either digital or analog is just reading noise and giving readings that are not valid. Adding a wire just increases the noise level and therefore increases the variations in readings. The results of reading a digital or analog input pin is only valid if there is a 'valid' electrical signal wired to the pin. And 'valid' has several requirements.
Googling " 'floating input pin'" and wikipedia gives me really a lot of great information.
I guess I need to learn how to activate the internal pull up resistor, because I don't want to add resistors on every input!
Will read a lot, thanks for the hint
Well I would ask why would you want to read a pin that has nothing wired to it in your sketch? Floating input pins are not a problem if you are not using those pins for anything useful.
I guess I need to learn how to activate the internal pull up resistor, because I don't want to add resistors on every input!
I would state you really meant: I guess I need to learn how to activate the internal pull up resistor, because I don't want to add resistors on every input that I will be using!
So, yes pull-ups, either external or internal, are required in some cases, as in simple switch contacts. Other times they are not needed, and for sure if you are not using a input pin at all it does not have to be pulled up.