4

i have a problem with the gpio sysfs files. when i use cat to get the values of a gpio pin it will always show 0. but after using a python script ( https://github.com/elParaguayo/RPI-Info-Screen/blob/PiTFT/pitftgpio.py ) the pins work normally.

im using the normal commands to adress the gpio: sudo sh -c 'echo 23 > /sys/class/gpio/export' , setting direction and then cat /sys/class/gpio/gpio23/value

  • What are you doing to the gpio to make it change value? All the Python code seems to do is open gpio 23 as an input and set a pull-up to 3V3. – joan Apr 16 '14 at 17:00
  • Maybe something like 'echo "in" > /sys/class/gpio/gpio23/direction' to specify pin23 as an input, I'm not sure how to set the pullup. – francis Apr 17 '14 at 9:44
  • thanks, i think its the pull-up. i set the direction,but forgot to mention it ;) – tly Apr 17 '14 at 10:51
  • is it necessesary to set the pull-up? – tly Apr 17 '14 at 13:38
  • It depends on what is connected to the gpio. If nothing is connected it will float randomly between 0 and 1. The pull-up will fix the gpio high unless an external circuit pulls it low. – joan Apr 17 '14 at 17:29

Browse other questions tagged or ask your own question.