Could not find GPIO edge file on OrangePi Lite

59 Views Asked by At

Today when I started learning how to use the JavaScript "onoff" library and then ran into some problems with them, specifically.

First of all, I cannot use the names of the existing GPIOs and the names in the wPi, I can only use the BCM.

When I use the pins declared in BCM to blink the led, it works great. But when I use some other pins as buttons I get the error:

gpio: Warning: File not present: /sys/class/gpio/gpio110/edge

and it's clear that the edge folder isn't actually there. When I use:

echo "1" > /sys/class/gpio/gpio110/value

for the pins that don't have an edge file, I get the error:

-bash: echo: write error: Operation not permitted

OrangePiLite I/O

A problem I encountered

Trying to use echo "1" > /sys/class/gpio/gpio110/value

I tried manually copying the edge files from the existing files of other GPIO but that doesn't seem to be possible. Does anyone know how to fix it or can give me more information about them?

1

There are 1 best solutions below

4
owl magican On

Finally, I got to use GPIO pins with out edge. It was a mistake when I tried to read its rising and falling edges. Just declare GPIO and use:

button.readSync()

Here is my simple code:

const Gpio = require('onoff').Gpio;
const button = new Gpio(71, 'in', {debounceTimeout:50});

const readbutton = _ => {

console.log(button.readSync());  
setTimeout(readbutton, 100);

};

readbutton();

process.on('SIGINT', _ => {
led.unexport();
button.unexport();

});

and in the npm onoff I found this here

npm onoff image