How to test GPIO pins on Android

(Chong Thien Pow) #1

To test GPIO on Android with your newly acquired BPI-M64

Prepare the test LED by following the pic below:

Red connect to PB0 (pin 8) Black connect to GND (pin 6)


  1. connect the microUSB OTG cable to your PC.

  2. power up and wait till it boot into the Android Welcome screen.

  3. make sure you are connected and have proper full access to the device by following the adb commands below:
    adb devices adb root adb remount adb shell

  4. after inside the shell type the following and press enter: setenforce 0

  5. connect the LED like in the picture. always connect the GND(black) first,

  6. type the following and enter, the LED will power on and light up: echo 1 > /sys/class/gpio_sw/PB0/data

  7. to power off echo 0 > /sys/class/gpio_sw/PB0/data

(BPI_Justin) #2

good job …

(Edmilson Junior) #3

How can i read a gpio on my app? Can you help me?

(Tatiana Smith Solana) #4

It doesn´t work, BPI.M64 isn´t recognized by the PC over micro USB. I run ABD commands with the M2 without any problem. Why the M64 isn´t recognized? Sugestions??