Announcement

Collapse
No announcement yet.

4DCape-43 user buttons

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 4DCape-43 user buttons

    Is it possible to make use of the left / right / up / down / enter buttons and the user LED in your own applications? I've been using the Adafruit_BBIO.GPIO module in python to set outputs, so I assumed that I'd be able to just query the input values from these buttons as well using something like the following for the 'left' button.

    import Adafruit_BBIO.GPIO as GPIO

    GPIO.setup('P9_15', GPIO.IN)
    GPIO.input('P9_15')

    But the setup command gives the following exception

    ValueError: Set gpio direction failed, missing file or invalid permissions. Note that I am running as root, so I wouldn't think permissions would be a problem.

  • #2
    Hello DKP,

    The five buttons is by default set to act as keyboard input keys. You will first have to manipulate the overlay for using the buttons for other use, like discussed in this forum thread:
    https://forum.4dsystems.com.au/forum...t-gpio-key-map

    Best Regards

    Comment


    • #3
      Jerson,

      Thanks for the info. Since you say the buttons act as keyboard keys by default, does that mean that w/o changing anything that I should be able to query them in python by binding events to their corresponding token (e.g. 'F12' for Left)? My binding works when my GUI is displaying on another machine, but when I display on the cape the event is not triggered.

      Re-configuring the kernel is a little more work than I was looking to do at the moment, but nice to know the possibility is there if I need to.

      Comment

      Working...
      X