Trouble

RPi GPIO on python issue

6 2069
Edited by ctrl_alt_d at Sun Dec 28, 2014 17:04

gpio readall command runs fine. Results looks like:
  1. bananapi@lemaker ~/ull $ sleep 10;gpio readall
  2. +-----+-----+---------+------+---+--Banana Pro--+---+------+---------+-----+-----+
  3. | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
  4. +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
  5. |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
  6. ...
  7. |  17 |   0 | GPIO. 0 |   IN | 1 | 11 | <--- Notice BCM 17 ( BOARD 11 ) is 'up' because it has voltage.

Copy the Code
But when I read it from python always returns '1' (tested with and without voltage)
  1. bananapi@lemaker ~/ull $ sudo python
  2. Python 2.7.3 (default, Mar 18 2014, 05:13:23)
  3. [GCC 4.6.3] on linux2
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> import time, RPi.GPIO as GPIO
  6. BAPI: Banana Pi!!
  7. BAPI: Banana Pi!!
  8. BAPI: Banana Pi!!
  9. BAPI: Banana Pi!!
  10. BAPI: revision(3)
  11. >>> GPIO.setmode(GPIO.BOARD)
  12. >>> GPIO.setup(11,GPIO.IN)
  13. >>> GPIO.input(11)
  14. 1
  15. >>> time.sleep(10);GPIO.input(11)
  16. 1
  17. >>> GPIO.setmode(GPIO.BCM)
  18. >>> GPIO.setup(17, GPIO.IN)
  19. >>> time.sleep(10);GPIO.input(17)
  20. 1

Copy the Code
What is wrong?


when do you change the input voltage state. And if the voltage you input has the same reference ground?

Connect ground to pin 11 (gpio 17) and run the command again, it should change to 0.

Edited by ctrl_alt_d at Mon Dec 29, 2014 16:35

tony_zhang, actkk2000 thanks about fast reply!

Isolated issue. gpio readall runs right, but, from python RPi.GPIO is not running.

I have a capacitor binded to banana pi, I can see with 'gpio readall' command how GPIO change from 0 to 1 and from 1 to 0 when I touch sensor, but I'm unable to read values from python.

I have tested with GPIO.setmode(GPIO.BCM), also with GPIO.setmode(GPIO.BOARD), scanning all pins, etc, but value not change.

What may be the reason of this behavior?

regards.

tony_zhang replied at Sun Dec 28, 2014 20:14
when do you change the input voltage state. And if the voltage you input has the same reference grou ...

tony_zhang, I get voltage from banana ( pin 1 )

I have post new test more simple and detailed, thanks.

ctrl_alt_d replied at Mon Dec 29, 2014 16:00
tony_zhang, I get voltage from banana ( pin 1 )

I have post new test more simple and detailed, th ...

If you want to make the pin to be low, you need connect ground to the pin as actkk2000 said.

hodoors  
Note: The author has been banned or deleted.

You have to log in before you can reply Login | Sign Up

Points Rules