1.5.0 • Published 4 years ago

raspberrypi-button v1.5.0

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

raspberrypi-button

Overview

Monitor momentary push button switch on Raspberry Pi

Install

Be sure you have installed WiringPi python library on your Raspberry Pi.

sudo pip install wiringpi

Then install this module

npm i raspberrypi-button

Usage

This library is using WiringPi pin numerotation ! Simply instantiate a Button object specifying the pin number and the pullup mode (default false) into the constructor method. Then listen for the 'pressed', 'released' and/or 'changed' events on the Button object.

const Button = require('raspberrypi-button');

// Declare a button on pin 0
const button = new Button(0);

//Listen for events on the button
button.on('pressed', () => console.log('button is pressed'));
button.on('released', () => console.log('button is released'));
button.on('changed', (value) => console.log('button value is :', value));
1.5.0

4 years ago

1.2.0

4 years ago

1.3.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago