a1-raspberry

1.0.3 • Public • Published

a1-raspberry

Utilities for Raspberry PI devices. Promise based. Zero dependencies.

Note: this library uses the BCM pinout by default. See https://pinout.xyz/

Installation

npm install a1-raspberry

Usage

GPIO pins

The module uses the gpio command installed in the raspberry. See http://wiringpi.com/the-gpio-utility/ for available options. For the sake of simplicity the module uses the BCM pinout (by adding the -g flag to the gpio command)

const { gpio } = require('a1-raspberry')
const PIN = 4
await gpio.configure(PIN, 'out') // configure as output
await gpio.write(PIN, 1) // set pin to 3.3V
setTimeout(() => { gpio.write(PIN, 0) }, 5000)
const val = await gpio.read(PIN) // return 1 (3.3V)
gpio.execute('gpio -g write 4 1') // execute a custom command

Package Sidebar

Install

npm i a1-raspberry

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

3.62 kB

Total Files

5

Last publish

Collaborators

  • ax1