js-gpiozero
Version:
A simple interface to GPIO devices with Raspberry Pi using nodejs
55 lines (33 loc) • 3.74 kB
Markdown
# js-gpiozero
[](https://travis-ci.org/i-am-digital/js-gpiozero) [](https://codecov.io/gh/i-am-digital/js-gpiozero) [](https://badge.fury.io/js/js-gpiozero) [](https://nodesecurity.io/orgs/iamdigital/projects/4bd73f7b-9fb7-43b8-823e-49064af553e4) [](https://www.bithound.io/github/i-am-digital/js-gpiozero/master/dependencies/npm) [](https://www.bithound.io/github/i-am-digital/js-gpiozero) [](https://www.bithound.io/github/i-am-digital/js-gpiozero) [](https://github.com/semantic-release/semantic-release)
A port of the fanastic [python gpiozero](https://github.com/RPi-Distro/python-gpiozero) to javascript creating simple interface to everyday GPIO components used with Raspberry Pi on node.js.
It's early days and a work in progress!
## Documentation
The API Documentation is available at the repos [github-pages](https://i-am-digital.github.io/js-gpiozero/).
## Using
First of all we need to be running the latest version of nodejs (at least v6). The following command updates the Debian apt package repository to include the NodeSource packages
```bash
$curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
```
Now that we have added the NodeSource package repository, we can move on and install Node.js!
```bash
$ sudo apt install nodejs
```
We can then test and see what version of Node we are running
```bash
$ node -v
v7.3.0
```
## Contributing [](https://github.com/i-am-digital/js-gpiozero/issues) [](http://commitizen.github.io/cz-cli/)
The project is very much a work in progress. Some far the output part of gpiozero has been followed through, completing a near direct translation from the original Python. This means the operating model hasn't really taken advantage of the nodejs programming paradigm. That's next! It's mostly written in EMCAScript 5 with a splash of 6, the intention is to written everything in 6, then use babel to create an output that nodejs can use. The projects tab shows current work, planned and in progress, feel free to pick up a task and have a go.
The documentation is produced by [jsdoc](https://www.npmjs.com/package/jsdoc), enabling the api documentation to be written within the source code. Upon committing to git, a pre-commit task will run, this runs all tests and updates the documentation. Checkout [Git Hooks](https://www.atlassian.com/git/tutorials/git-hooks/local-hooks) for more info.
To enable this the follow line needs to be executed:
```bash
$ln -s ../../pre-commit.sh .git/hooks/pre-commit
```
or you can simply run the following command:
```bash
$npm run docs
```
More info about contributing can be found [here](https://github.com/i-am-digital/js-gpiozero/blob/master/CONTRIBUTING.md)
[](https://nodei.co/npm/js-gpiozero/)