4

I've installed the GPIO python library to read/write to GPIO pins. To get the state of the pins I'm using "gpio readall" which displays a table with all the pins from the RPI and I can see which pin is HIGH and which one is LOW.

The problem i'm facing is that if I connect a ribbon cable to RPI (the other end of the cable is not connected) and run the "gpio readall" command multiple times one after another I see different values for the pins... the values are randomly changing... but if I remove the ribbon cable and run the same command multiple times I get all the time the same result...

I'm expecting to see the same values with or without the ribbon cable connected...

Do you have any idea why is that ?

Piotr Kula
  • 17,336
  • 6
  • 66
  • 105
lorandd
  • 41
  • 1

2 Answers2

7

Pins cannot be left floating, the value will be indeterminate without at least SOME external hardware (pull--up or -down resistors, etc.). The ribbon cable may act as an antenna and pick up additional noise that may otherwise not be present, giving more variation.

Tevo D
  • 831
  • 8
  • 13
1

It is actually possible to set up the RasPi input ports with/without pull up/pull down resistors. check the GPIO register descriptions available on the net.

sebix
  • 105
  • 7