jaroslav.falcon píše:
u atmegy v defaultu nejsou piny mapované, při inicializaci se pin musí nastavit In Out PullUp
Ano nicméně v případě Arduina to je ošetřeno v SW jádře implicitní inicializací příslušných pinů jako vstupy tj. když není ve zdrojáku pro Arduino uvedeno volání pinMode() pro konkrétní piny tak jsou i tak inicializovány jako vstupy. Nicméně v tomto stavu jsou velmi citlivé a může se na nich projevovat šum jak vyplývá z popisu viz citace. Zdroj
viz tento odkaz.
Citace:
Properties of Pins Configured as INPUT
Arduino (Atmega) pins default to inputs, so they don't need to be explicitly declared as inputs with pinMode() when you're using them as inputs. Pins configured this way are said to be in a high-impedance state. Input pins make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 megohm in front of the pin. This means that it takes very little current to move the input pin from one state to another, and can make the pins useful for such tasks as implementing a capacitive touch sensor, reading an LED as a photodiode, or reading an analog sensor with a scheme such as RCTime.
This also means however, that pins configured as pinMode(pin, INPUT) with nothing connected to them, or with wires connected to them that are not connected to other circuits, will report seemingly random changes in pin state, picking up electrical noise from the environment, or capacitively coupling the state of a nearby pin.