Control GPIO for bananaPi boards
npm install bpi-gpioA minimal package to control the GPIO pins for BananaPi using node.
---
---
>gpio -v
If there are no errors, you are good to go :)
---
1.mode(pin, mode)
This function takes two arguments the first one is the GPIO number and the second is the mode,
until now we have just two modes(OUTPUT or INPUT)
Example:
>const GPIO = require('bpi-gpio')
const LED = 17
GPIO.mode(LED, GPIO.OUTPUT)
###
2.read(pin)
This function takes just one argument which is the GPIO pin number.
Example:
>const GPIO = require('bpi-gpio')
const LED = 17
GPIO.read(LED)
3.write(pin, value)
This function takes two arguments the first one is the GPIO pin number and the second
is the value you want to write
hint: you should change the pin mode to OUTPUT before using this function.
Example:
>const GPIO = require('bpi-gpio')
const LED = 17
GPIO.mode(LED, GPIO.OUTPUT)
GPIO.write(LED, GPIO.HIGH)