• Recent
    • Docs
    • Github
    • 百度网盘
    • Onedrive
    • Official
    • Shop
    • Register
    • Login

    4B GPIO口无法读取输入电平

    Scheduled Pinned Locked Moved Pi 4B
    5 Posts 3 Posters 953 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      obsidian
      last edited by

      系统UBUNTU 20.04,PYTHON3.8.
      GPIO口用作输出一切正常。但是用作输入,只能读到高电平1
      测试代码,使用sudo运行
      import CPi.GPIO as GPIO
      import time
      GPIO.setmode(GPIO.BOARD)
      PIN=40
      GPIO.setup(PIN,GPIO.IN)
      while True:
      print(GPIO.input(PIN))
      time.sleep(1)
      40引脚通过1K电阻与地连接
      后更换其他GPIO口、使用GPIO.RK配置,都只能读到高电平

      J 1 Reply Last reply Reply Quote 0
      • J
        jack_admin @obsidian
        last edited by

        @obsidian 这个问题我确认一下

        O 1 Reply Last reply Reply Quote 0
        • O
          obsidian @jack_admin
          last edited by

          @jack_admin 今天重新做了一个 20230613-ubuntu-22.04-preinstalled-desktop-arm64-cp4b.img 的TF卡,并只安装了cpi.gpio-1.0.0-cp310-cp310-linux_aarch64.whl
          这次输入口读取正常(只试了第40脚)。所以应该可以排除硬件损坏的可能性。
          明天我再重装一个 20.04的看看

          J 1 Reply Last reply Reply Quote 0
          • J
            jack_admin @obsidian
            last edited by

            @obsidian 那有可能是python gpio包没有同步更新。

            W 1 Reply Last reply Reply Quote 0
            • W
              weiweiwei @jack_admin
              last edited by

              @jack_admin 那要怎么更新呢

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post