# orange-pi-gpio

> This module allows you to easily manage GPIO pins on your **Orange PI PC** using **Node.js**

Latest version **1.0.2** (published 2017-10-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install orange-pi-gpio
pnpm add orange-pi-gpio
yarn add orange-pi-gpio
bun add orange-pi-gpio
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-10-14 |
| First published | 2017-10-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Boris Kotlyarov |
| Maintainers | boris-kotlyarov |

## Links

- npm: https://www.npmjs.com/package/orange-pi-gpio
- Repository: https://github.com/BorisKotlyarov/orange-pi-gpio
- Homepage: https://github.com/BorisKotlyarov/orange-pi-gpio#readme
- Issues: https://github.com/BorisKotlyarov/orange-pi-gpio/issues
- npm.io page: https://npm.io/package/orange-pi-gpio

## Recent versions

- 1.0.2 (latest) — 2017-10-14

## README

# orange-pi-gpio #
This module allows you to easily manage GPIO pins on your **Orange PI PC** using **Node.js**

## Before Install ##
You need to make sure that **WiringOP** is installed on your **Orange PI PC**.
If not, then you need to install it.
To do this, run the following commands:

```cmd
git clone https://github.com/zhaolei/WiringOP.git -b h3

cd WiringOP
chmod +x ./build
sudo ./build
```

## Install Module##

```cmd
npm i orange-pi-gpio
```

## Usage ##

**Blink app**
```javascript
const Gpio = require('orange-pi-gpio');

let gpio5 = new Gpio({pin:5, mode: 'out', ready: ()=>{
    let value = 1;

    setInterval(function() {
        process.stdout.write('\x1B[2J\x1B[0f\u001b[0;0H');

        if(value){
            console.log('\x1b[32m%s\x1b[0m', `ON`);
        } else {
            console.log('\x1b[31m%s\x1b[0m', `OFF`);
        }
        
        gpio5.write(value);
        value = +!value;
    }, 50);

}});
```

## Methods ##

**read**
```javascript
const Gpio = require('orange-pi-gpio');

let gpio5 = new Gpio({pin:5});

gpio5.read()
    .then((state)=>{
        console.log(state); //state of pin 5
    });
```


**write**
```javascript
const Gpio = require('orange-pi-gpio');

let gpio5 = new Gpio({pin:5});

gpio5.write(1); // write 1 to pin 5
gpio5.write(0); // write 0 to pin 5
```

---
_Source: https://npm.io/package/orange-pi-gpio · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
