GPIO input with android apps, specialized school project in need of help.

Hey everyone, I am part of a group of 5 students developing a platform utilizing the BBB and a series of external buttons as controls for a sort of trivia game for the elderly which may lack the somewhat precise motor skills required to work off a standard tablet. We decided to build this app as an android app. This has went relatively smoothly until now, We are trying to figure out how to utilize the GPIO of the BBB and buttons to work with the app. the wiring is not an issue i can make whatever pin needs to be made what do it. its the code and more software side we are having issues with. Can anyone aid in this? i have done some research on it thus far and see that each of the GPIO pins we would like to use need to be exported in the sys/class/gpio directory. but beyond this we do not have much of an idea.

Any help you can provide would greatly be appreciated.

Hi,

take a look at ‘http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/

There are also 2 documents for the p8, p9 header and the pin muxing.

You can try in parallel with ‘adb shell’ to export and setup the gpios you need.
For example for P9.42

./adb shell

cd /sys/class/gpio
echo 7

Hi,

see http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/ for more information.
There are also 2 pdfs with p9, p8 header tables for the pin muxing.

If you whant persistent pin muxing changes on the BBB you must change the device tree overlay!!!.

To check if its work in general us the adb shell.

An example for the p8.09:
./adb shell

cd /sys/class/gpio
echo 69 > export //creates gpio69 directory for the gpio access
chmode 777 gpio // to get access for the apk. the apk is never running as root.
cd gpio69
chmod 777 value
chmode 777 direction

you can change the direction and value by

echo 1 > value // set gpio high
echo out > direction // set gpio as output

have fun,