Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ax1/a1-raspberry
🍓 Utilities for Raspberry PI devices
https://github.com/ax1/a1-raspberry
Last synced: about 23 hours ago
JSON representation
🍓 Utilities for Raspberry PI devices
- Host: GitHub
- URL: https://github.com/ax1/a1-raspberry
- Owner: ax1
- Created: 2019-02-21T10:56:20.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-30T11:19:46.000Z (almost 4 years ago)
- Last Synced: 2024-12-14T05:13:00.247Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
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)
```javascript
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
```