# nodary-encoder

> Simplistic event-based NodeJS lib that serves rotary encoder data from GPIO pins on Raspberry Pi

Latest version **0.1.4** (published 2021-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install nodary-encoder
pnpm add nodary-encoder
yarn add nodary-encoder
bun add nodary-encoder
```

## 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.4 |
| Published | 2021-11-06 |
| First published | 2020-12-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matthieu Savary × User.Digital × User Studio |
| Maintainers | user.digital |
| Keywords | onoff, rotary, encoder, rotary encoder, dial, gpio, raspberry, pi, node, js |

## Links

- npm: https://www.npmjs.com/package/nodary-encoder
- Repository: https://github.com/smallab/nodary-encoder
- Homepage: https://github.com/smallab/nodary-encoder/
- Issues: https://github.com/smallab/nodary-encoder/issues
- npm.io page: https://npm.io/package/nodary-encoder

## Dependencies (1)

- [onoff](https://npm.io/package/onoff.md) ^6.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.4 (latest) — 2021-11-06
- 0.1.3 — 2021-01-01
- 0.1.2 — 2021-01-01
- 0.1.1 — 2020-12-31
- 0.1.0 — 2020-12-31

## README

# nodary-encoder

Based off https://github.com/nstansby/rpi-rotary-encoder-python & https://github.com/pichfl/onoff-rotary:
event-based *NodeJS* lib that relies on https://github.com/fivdi/onoff to get *rotary encoder* (such as https://thepihut.com/products/rotary-encoder-extras) data from *GPIO* pins on *Raspberry Pi*.

## Installation
```shell
npm i nodary-encoder --save
```

## Usage
```js
const nodaryEncoder = require('nodary-encoder');
const myEncoder = nodaryEncoder(17, 18); // Using GPIO17 & GPIO18

myEncoder.on('rotation', (direction, value) => {
  if (direction == 'R') {
    console.log('Encoder rotated right');
  } else {
    console.log('Encoder rotated left');
  }

  console.log('Value is', value);
});
```

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