I've been playing a lot with the Raspberry Pi lately. But I have a problem.
When I set up an input pin to check whether electricity is sent to it or not, it gives me rather unstable answers.
A few observations I've made to clarify my problem:
When I connect the circuit, and electricity flows to the input pin, the value it gives me is consistently TRUE or 1.
When I break the circuit by removing a LED that is a part of it (when the input value should be 0) it gives me random values, shifting between 0 and 1.
When I remove all the cables from my Pi it gives me the consistent value of 0
If i have all the GPIO cables removed it gives me the value of 0, but if I simply touch the input pin with a piece of electricity leading metal, (leading to nothing at the other end) it starts with the random values again. It does not give me random values unless I have something connected to the output pin as well. It does not have to lead anywhere, it just has to touch the output pin. And some other piece of metal has to touch the input pin. No connection at all between them.
I wonder why it starts giving me random values as the Input GPIO pin touches any metal.
And even more intresting, why does it give me consistant 1s or TRUEs when I actually send electricity to it?