npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-wiringpi

v0.0.1

Published

Node bindings for libwiringPi

Downloads

5

Readme

node-wiringpi

Extremely simple node wrapper for @drogon's wiringPi library (for blinky lights & gpio w/ RaspberryPi)

Caution

This package assumes you know how to safely handle electronics and program GPIO pins. It's concievable you could damage yourself or your Raspberry Pi with improper circuit design or improper use of software interfaces. While the author of this package has made reasonable efforts to insure the accuracy of the information and code contained within, it comes with absolutely no warranty or guarantee of correctness.

Pre-Requisites

Before installing and/or building this package, please make sure you have the wiringPi library and the node-gyp package installed. WiringPi info can be found at https://projects.drogon.net/raspberry-pi/wiringpi/. Node-Gyp info can be found at https://github.com/TooTallNate/node-gyp.

Installation

The easiest way to install this package is via npm:

Or, you can check out the source using git:

Building

If the package wasn't automagically built when you installed via npm, this command should do the trick:

You'll have problems if you haven't installed node-gyp or libwiringPi.

Testing

I wrote a very simple LED blinker (this assumes you have a RPi w/ LEDs attached to GPIO pins. To run the program, use the command:

You have to run the program as root so it has permission to access /dev/mem. You could modify the permissions on this file, but please don't do that unless you understand how big of a security hole you're creating.

API

We currently only support two wiringPi calls: pinMode() and digitalWrite(). Hopefully the only thing you wanted to do was to write to the GPIO ports.

Start off by requiring the package:

If you're curious, you can call the num_pins() function to find out how many GPIO pins you have:

Before you write to GPIO lines, you should set them in output mode. This snippit sets pins 0 and 1 into output mode:

Once in output mode, you can write HIGH or LOW values to the pin. This sequence turns pins 0 and 1 on and off: