Accessing GPIO using andriod app


#1

How do I execute “echo 1 > sys/class/gpio/gpio915/value” from my Android app. I have tried
Process p = Runtime.getRuntime().exec(“echo 1 > sys/class/gpio/gpio915/value\n”); But it did not work.


#2

http://stackoverflow.com/questions/20932102/execute-shell-command-from-android might have info to help you.


#3

http://stackoverflow.com/questions/20932102/execute-shell-command-from-android using this I was able to run commands other than “echo” . “echo 1 > sys/class/gpio/gpio915/value” is not getting executed.


#4

Just to confirm, you don’t have a typo in your command?
It’s /sys/class/gpio…, NOT sys/class/gpio…
Missing root ‘/’.


#5

Yes it was a typo here. I have ‘/’ in my code.


#6

How did you determine that it didn’t work or get executed? Do you have any error logs to share? Or is it just your led not lightning up? If so, have you done echo out > /sys/class/gpio/gpioXX/direction?


#7

Hi @Rohit Bandi,

I would like to know if you could finish your app, I am having the same problem and I have not solved yet.

Thank you in advance.