gpioandroid-things

Problem access to GPIO rasbery pi 3 with android things


I want to turn on A LED with android things and raspberry Pi 3. I did it as instructed in https://developer.android.com/things/sdk/pio/gpio. And I am using last android things version (1.0.15). any comments why I get a such error?

2009-01-01 03:30:07.762 667-667/com.inflashpay.inflash E/Request Permission: List of available ports: [BCM2] 2009-01-01 03:30:07.774 667-667/com.inflashpay.inflash E/Request Permission: Unable to access GPIO com.google.android.things.pio.PioException: android.os.ServiceSpecificException: BCM2 failed to apply the required pin mux: No such file or directory (code 2)

added:

private static final String LED = "BCM2";
private Handler mHandler = new Handler();
private Gpio mLedGpio;
    PeripheralManager service = PeripheralManager.getInstance();
    Log.i(TAG, "Available GPIO: " + service.getGpioList());
    try {

        mLedGpio = service.openGpio(LED);
        mLedGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW);
        Log.i(TAG, "Start blinking LED GPIO pin");
        // Post a Runnable that continuously switch the state of the GPIO, blinking the
        // corresponding LED
        mHandler.post(mBlinkRunnable);
    } catch (IOException e) {
        Log.e(TAG, "Error on PeripheralIO API", e);
    }

Solution

  • I modified CONFIG file because I needed to use a monitor needed to change resolution there, and when I restored it to default problem solved.