# node-gpio

> A GPIO module for single board computers like the Raspberry Pi or the Banana Pi written in C++

Latest version **0.1.1** (published 2014-10-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-gpio
pnpm add node-gpio
yarn add node-gpio
bun add node-gpio
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-10-10 |
| First published | 2014-10-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 17 |
| Author | Paul Varache |
| Maintainers | paulvarache |

## Links

- npm: https://www.npmjs.com/package/node-gpio
- Repository: https://github.com/paulvarache/node-gpio
- Issues: https://github.com/paulvarache/node-gpio/issues
- npm.io page: https://npm.io/package/node-gpio

## Recent versions

- 0.1.1 (latest) — 2014-10-10
- 0.1.0 — 2014-10-09

## README

Node GPIO
==============

A GPIO module for single board computers like the Raspberry Pi or the Banana Pi written in C++.
--------------

Based on the sysfs, this module provides:

- Simple GPIO
- PWM
- Capacitive touch

The capacitive touch object uses two pins. One for charging the capacitor and the second to get the value.

Check out the example, they are quite self explanatory.

GPIO
*Light a led*

```javaScript
    var gpio = require('node-gpio');
    var GPIO = gpio.GPIO;

    var led = new GPIO("28");
    led.open();
    led.setMode(gpio.OUT);
    led.write(gpio.HIGH);
```
*Wait for a button push*
```javaScript
    var gpio = require('node-gpio');
    var GPIO = gpio.GPIO;

    var button = new GPIO("28");
    button.open();
    button.setMode(gpio.IN);
    button.on("changed", function (value) {
        console.log(value);
    });
    button.listen();
```

PWM
*Lightly light a led*

```javaScript
    var gpio = require('node-gpio');
    var PWM = gpio.PWM;

    var led = new PWM("28");
    led.open();
    led.setMode(gpio.OUT);
    led.frequency = 100;
    led.dutyCycle = 50;
    led.start();
    led.stop();
```

CapacityTouch
*Display all events on a capacitive touch device*

```javaScript
    var gpio = require('node-gpio');
    var CapacityTouch = gpio.CapacityTouch;

    var touch = new CapacityTouch("24", "28");
    touch.open();
    touch.on("changed", function (data) {
        console.log("Value: " + data.value);
        console.log("Charge time: " + data.charge);
    });
    touch.listen();
```

Every GPIO can be closed with:

```javaScript
    pin.close();
```

An event listening can be stoped with:
```javaScript
    pin.stopListening();
```

Do whatever you want with this module, I don't care.

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