GithubHelp home page GithubHelp logo

wiringpi / wiringpi-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from soarez/node-wiring-pi

330.0 33.0 92.0 222 KB

Node.js bindings to wiringPi

Python 1.48% JavaScript 0.09% Shell 2.21% C++ 92.20% C 4.01%

wiringpi-node's Introduction

Node.js bindings to wiringPi

Based on the awesome work of Soarez

Install

npm install wiring-pi

Usage

var wpi = require('wiring-pi');

Documentation

See the DOCUMENTATION.md file for more detailed documentation.

Contributing

wiring-pi is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See the CONTRIBUTING.md file for more details.

Contributors

wiring-pi is only possible due to the excellent work of the following contributors:

Contributor GitHub profile Twitter profile
Igor Soarez (Creator) Soarez @igorsoarez
Leandre Gohy nekuz0r @LeandreGohy
Eugene Ware eugeneware @eugeneware
Ivo Stratev NoHomey
Chris Continanza csquared @csquared
Tao Yuan taoyuan @taoyvan
Tom Janson tjanson
Vincent Terraillon LouTerrailloune @pure74vincent

wiringpi-node's People

Contributors

csquared avatar eugeneware avatar louterrailloune avatar majorbreakfast avatar nekuz0r avatar nohomey avatar taoyuan avatar the-alchemist avatar tjanson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wiringpi-node's Issues

Typo selecting speed argument for wiringPiSPISetup

There is a typo in wiringPiSPI.cc where the first argument to wiringPiSPI.cc is selected for the channel and the speed. The following patch fixes it.

diff --git a/src/wiringPiSPI.cc b/src/wiringPiSPI.cc
index a8210f6..37920fc 100644
--- a/src/wiringPiSPI.cc
+++ b/src/wiringPiSPI.cc
@@ -63,7 +63,7 @@ IMPLEMENT(wiringPiSPISetup) {
   CHECK_ARGUMENT_TYPE_INT32(1);

   int channel = GET_ARGUMENT_AS_INT32(0);
-  int speed = GET_ARGUMENT_AS_INT32(0);
+  int speed = GET_ARGUMENT_AS_INT32(1);

   CHECK_ARGUMENT_IN_INTS(0, channel, (0, 1));

wiringPiISR is crashing

wiringPiISR implementation need to be rewrote using uv_async_send instead of uv_queue_work.

[2.1.1] Officially Release 2.1.1

Currently wiring-pi latest versions at npm and here in github releases both point to 2.1.1 but in the Changelog 2.1.1 is marked as not released yet... So what stops 2.1.1 to be officially released?

Is working at B+ and Raspberry Pi B 2

Hello!
I use your works very well to my raspberry pis..
But unfortunately, B+ and B 's additional gpios are not working at wiring-pi.
I think this project are referencing old wiringpi (Native C library).
Could you have any plan to upgrade this project to use B+ and B 2?

wiringPiISR triggering callback continuously

I'm having an issue where when using wiringPiISR interrupts, the callback is triggered continuously once a button has been pressed.

When I run the following code:

var wpi = require('wiring-pi');
wpi.setup('wpi');

// // setup
wpi.pinMode(27, wpi.INPUT);
wpi.pullUpDnControl(27, wpi.PUD_UP);

wpi.wiringPiISR(27, wpi.INT_EDGE_FALLING, function(delta) {
  console.log('Pin 7 changed to LOW  (', delta, ')');
});

setInterval(function() {
    console.log('waiting');
}, 2000);

This is the output I get:

waiting
waiting
waiting
waiting
waiting
waiting
Pin 27 changed to LOW    ( 12908576 )
Pin 27 changed to LOW    ( 979 )
Pin 27 changed to LOW    ( 26 )
Pin 27 changed to LOW    ( 15 )
Pin 27 changed to LOW    ( 15 )
Pin 27 changed to LOW    ( 17 )
Pin 27 changed to LOW    ( 14 )
Pin 27 changed to LOW    ( 13 )
Pin 27 changed to LOW    ( 13 )
Pin 27 changed to LOW    ( 14 )

It logs 'waiting' until the button is pressed. The output continues then like this, registering the delta as around 14.

I had exactly the same setup previously and it only triggered the callback once (or twice due to the switch bouncing). This new behaviour has only happened since I did a 'sudo apt-get update' and 'sudo apt-get upgrade'.

I have an equivalent test program in python using RPi.GPIO and interrupts and that seems to work as normal, so wondering what could have caused this change...

Thanks

how can i read the pin mode

There is a core function to set the pin mode named pinMode(pin,mode), but how can i get the pin mode(OUT or IN)?

No timeout exposed on pulseIn

Reading the documentation on the use of the pulseIn() function, it talks about returning 0 if no pulse is measured in the specified timeout. Unfortunately, there doesn't appear to be a parameter to supply a timeout. Would it be possible to clarify the docs to discuss the timeout (if present) is more detail?

Installation error: Cloning of libWiringPi failed.

SOLVED.

REASON of bug: The "git" package was not installed.

I want to install wiring-pi on my Ubuntu 15.10 laptop, but got some error messages.
I have installed Node 4.x from https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

And have these versions:
$ nodejs --version
v4.2.4
$ node --version
v4.2.4
$ npm --version
2.14.12

$ lsb_release -a
Distributor ID: Ubuntu Linux 15.10
Release 15.10 wily

I have attached /home/moma/npm-debug.log and package.json.
npm-debug.zip

$ sudo npm install wiring-pi
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data

[email protected] install /home/moma/node_modules/wiring-pi
/bin/bash ./install.sh

Cloning libWiringPi ... failed.

FATAL: Cloning libWiringPi failed.
Please check install.log and fix any problems. If you're still stuck,
then please open a new issue then post all the output and as many details as you can to
https://github.com/eugeneware/wiring-pi/issues


npm ERR! Linux 4.2.0-22-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "wiring-pi"
npm ERR! node v4.2.4
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: /bin/bash ./install.sh
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script '/bin/bash ./install.sh'.
npm ERR! This is most likely a problem with the wiring-pi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! /bin/bash ./install.sh
npm ERR! You can get their info via:
npm ERR! npm owner ls wiring-pi
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/moma/npm-debug.log
moma@kursk1510:~$

BTW: I managed to Install Nodejs, npm and wiring-pi on Raspberry Pi2 with Rasbian-distro. Also my exsamples of wiring-pi run fine on RPi2. Nice.
Thanks in advance.

Contributing to Examples

I want to fork the project and provide Example Scripts for each feature presented in the documentation and then create a pull request to add the files to the examples directory.

However, it seems that addition of new examples requires the directory structure to be more organized. My suggestion is to use the structure provided in the Arduino IDE.

image

The goal here is to provide an example code for each part of the documentation, so newbies can start writing their own code easily and quickly.

Do you have any tips on how I should proceed to this?

Development mode

Hi,

Thanks for this amazing lib! However, I have a feature request that would greatly improve development.
It would be great if the lib could detect if it's running on a RPi or not. If it is, then it builds normally using node-gyp. If it doesn't, it could fallback into development mode, which can be as simple as logging what method is called.

This would allow a RPi specific app to be runnable in another environment.

A solution may be:

  • In install.sh
    • Check the existence of /opt/vc/bin/raspivid that seems to be present only on RPi
      • If it exists, build wiring-pi
      • Else, touch DEVELOPMENT
  • Wrap the current code and check if DEVELOPMENT exists
    • If it exists, run into development mode
    • Else, run normally

I think this should be pretty easy to implement... However, I can't do a PR as I don't feel confident about native extensions. ;)

Problem building wiring-pi on raspbian

I was trying to build it on my raspberry pi but it failed [1]. I thought this might have been due to old node version so I upgraded it to v6.8.1 and npm to 3.10.8 but it didn't help.

Also, it sounds like npm install shouldn't succeed in this case.

[1] compilation log:

(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
(node:7287) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

> [email protected] install /home/pi/node_modules/wiring-pi
> /bin/bash ./install.sh

Cloning libWiringPi ... done.
patching file ./wiringpi/devLib/Makefile
Hunk #1 succeeded at 24 with fuzz 1 (offset -2 lines).
Hunk #2 succeeded at 32 with fuzz 2 (offset -2 lines).
patching file ./wiringpi/gpio/Makefile
Making libWiringPi ... done.
Making devLib ...done.
Unistalling gpio utility ... done.
Making gpio utility ... done.
Installing gpio utility ... done.
Making wiring-pi ... (node:7721) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
make: Entering directory '/home/pi/node_modules/wiring-pi/build'
  CXX(target) Release/obj.target/wiringPi/src/addon.o
In file included from ../src/addon.h:4:0,
                 from ../src/addon.cc:1:
/home/pi/.node-gyp/6.8.1/include/node/v8.h:345:1: error: expected unqualified-id before ‘using’
/home/pi/.node-gyp/6.8.1/include/node/v8.h:481:1: error: expected unqualified-id before ‘using’
/home/pi/.node-gyp/6.8.1/include/node/v8.h:882:1: error: expected unqualified-id before ‘using’
/home/pi/.node-gyp/6.8.1/include/node/v8.h:5431:35: error: ‘virtual v8::EmbedderHeapTracer::~EmbedderHeapTracer()’ declared virtual cannot be defaulted in the class body
In file included from ../src/addon.cc:1:0:
../src/addon.h:12:24: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:12:44: error: expected primary-expression before ‘>’ token
../src/addon.h:12:46: error: ‘val’ was not declared in this scope
../src/addon.h:13:28: error: redefinition of ‘bool node::Buffer::HasInstance’
../src/addon.h:12:12: error: ‘bool node::Buffer::HasInstance’ previously defined here
../src/addon.h:13:24: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:13:45: error: expected primary-expression before ‘>’ token
../src/addon.h:13:47: error: ‘val’ was not declared in this scope
../src/addon.h:14:18: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:14:38: error: expected primary-expression before ‘>’ token
../src/addon.h:14:40: error: ‘val’ was not declared in this scope
../src/addon.h:15:22: error: redefinition of ‘char* node::Buffer::Data’
../src/addon.h:14:13: error: ‘char* node::Buffer::Data’ previously defined here
../src/addon.h:15:18: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:15:39: error: expected primary-expression before ‘>’ token
../src/addon.h:15:41: error: ‘val’ was not declared in this scope
../src/addon.h:16:21: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:16:41: error: expected primary-expression before ‘>’ token
../src/addon.h:16:43: error: ‘val’ was not declared in this scope
../src/addon.h:17:25: error: redefinition of ‘size_t node::Buffer::Length’
../src/addon.h:16:14: error: ‘size_t node::Buffer::Length’ previously defined here
../src/addon.h:17:21: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:17:42: error: expected primary-expression before ‘>’ token
../src/addon.h:17:44: error: ‘val’ was not declared in this scope
wiringPi.target.mk:135: recipe for target 'Release/obj.target/wiringPi/src/addon.o' failed
make: *** [Release/obj.target/wiringPi/src/addon.o] Error 1
make: Leaving directory '/home/pi/node_modules/wiring-pi/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.1.13+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/node_modules/wiring-pi
gyp ERR! node -v v6.8.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
done.
Enjoy !
/home/pi
└── [email protected]

Add GPIO multiplexer support

I am coming across projects where I need to use more GPIO pins than are physically available on the Pi. To solve my problems, I then use GPIO extenders such as PCF8574 and MCP23017. Since these are addressable devices in their own right, I can't use the wiringPi APIs such as digitalWrite and digitalRead directly against them.

This proposal suggests the enhancement of the wiring-pi module to allow us to pass an object as the pin parameter for some of the APIs. That object will be an interface (to be considered) that implements a GPIO extender set of parameters. This will allow me to use our existing module but when I want to read or write from an extended pin, I can pass in an object that implements the accessor. We will supply sample accessors for the common extenders.

I am happy to own or participate in this part of the project but want to pass it by the community for discussion and concurrence. If the idea isn't desired then I'll obviously not push it any further.

Neil

wiringPiISR as non root

The documentation states that

wiringPiISR method can be called as non root

This function will work in any mode, and does not need root privileges to work.

At the same time a call to this method fails until setup() which in its turn requires root privileges.
wiringPiSetup and friends have this in the documentation and my own tests shows that this is true.

This function needs to be called with root privileges.

So how to be if running the node as root is not an option? And what is the benefit in allowing to call wiringPiISR as non root if it requires initialization as root?

[Proposal] Switch to Nan

Node.js just released 7.0.0 and marked 6.9.1 as stable. In answer of this I suggest to switch addon.h from "manual Node.js version Addon absraction" to Native Abstractions for Node.js. Nan is the defacto standart for writing Node.js Addons and to keep compatibility between past and future releases of V8 and Node.js. I've used nan in some of my projects and is really easy to use. It will help to remove all redundancies from the macros and make them cleaner. Nan also provides some macros like NAN_METHOD to make the life of Addon developers easier.

I want to move the project to Nan because I've tried to build it with 6.9.0 version of Node.js last night and failed due to too many required changes needed (mainly to addon.h), as well to make it easier for wiring-pi to run on newer versions of Node.js. Not to mention that Node.js releases vulnerability bug fixes mainly for the LTS and Future rich versions, which as I state right now are 6.9.1 and 7.0.0.

wiringPiISR does not prevent node to terminate

Consider the following code:

var wpi = require('wiring-pi');

wpi.setup('gpio');

var pin = 17;

wpi.pinMode(pin, wpi.INPUT);
wpi.pullUpDnControl(pin, wpi.PUD_UP);

wpi.wiringPiISR(pin, wpi.INT_EDGE_FALLING, function(delta) {
  console.log("Hit ! " + delta);
});

When I run it, it will terminate immediately. I think it would be better if wiringPiISR() worked like setTimeout() and block until the interrupt is removed (is it possible to remove an interrupt after calling wiringPiISR() ?)

This is not a major issue for me, because I will run a web server that will keep the process running, but in some case it might be useful.

As a temporary fix I appended the following code to my program:

setTimeout(function(){
    console.log("Exiting...");
}, 5000);

I have 5 seconds to test my button, and it's working !

Release new sem. version

I would like to request a new sem. version release. Since all commits after 2.1.1 are result of mine pull requests beeing merged I would like to update both thе DOCUMENTATION.md and CHANGELOG.md so new version could be released. But first #51 needs to be closed.

New version is needed because of the following issues have been fixed since 2.1.1:

  • Fixing in which ints pinmodeAlt mode is checked, [https://github.com/eugeneware/wiring-pi/commit/24b09083ac5842a914e3369d5af69a4a3bf4bcba]
  • All WiringPi WPI_MODE_* constants are now exported, [https://github.com/eugeneware/wiring-pi/commit/e60dc3fd73ce5c48664ede14ab1c9d599796ce44]
  • sn3218 extention has been made available, (closes #42), [https://github.com/eugeneware/wiring-pi/commit/6931958c392968dd53d06cc39b133a6d852d0f46]
  • all file descriptors opened by wiring-pi are now releasable, (closes #43 ) [https://github.com/eugeneware/wiring-pi/commit/bf14d466b56761d5de40511549fbcd8b6c6ebe0c]

Cannot install wiring-pi because of libwiringpi cloning failed

When i tried to install wiring pi using npm, it failed and shown below error

# npm install wiring-pi

\
> [email protected] install /root/.node-red/node_modules/wiring-pi
> /bin/bash ./install.sh

Cloning libWiringPi ... failed.

================================================================================
FATAL: Cloning libWiringPi failed.
Please check install.log and fix any problems. If you're still stuck,
then please open a new issue then post all the output and as many details as you can to
  https://github.com/eugeneware/wiring-pi/issues
================================================================================

npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! [email protected] install: `/bin/bash ./install.sh`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the wiring-pi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     /bin/bash ./install.sh
npm ERR! You can get their info via:
npm ERR!     npm owner ls wiring-pi
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.1.7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "wiring-pi"
npm ERR! cwd /root/.node-red
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /root/.node-red/npm-debug.log
npm ERR! not ok code 0

The error tells me that I have to tell the wiring-pi author. Can you help me?

does not cross compile due to wiringpi makefile setup

wiring-pi does not crosscompile; the problem is that wiringpi hardcodes CC=gcc in its makefiles, so the wiringpi bits get always built with the host compiler. A possible solution is to add another patch that fixes that assingment to 'CC ?= gcc' and then set CC in the environment (i.e., install.sh) to point at CC.target.

Making gpio utility failed

Got this problem while install it in raspberry pi 2

screen output:

root@raspberrypi:~/web# npm install -g wiring-pi
/-
/> [email protected] install /usr/lib/node_modules/wiring-pi
/> /bin/bash ./install.sh

Cloning libWiringPi ... done.
patching file ./wiringpi/devLib/Makefile
Hunk #1 succeeded at 24 with fuzz 1 (offset -2 lines).
Hunk #2 succeeded at 32 with fuzz 2 (offset -2 lines).
patching file ./wiringpi/gpio/Makefile
Making libWiringPi ... done.
Making devLib ...done.
Unistalling gpio utility ... [sudo] password for nobody:
[sudo] password for nobody:
[sudo] password for nobody:
done.
Making gpio utility ... done.
Installing gpio utility ... [sudo] password for nobody:
[sudo] password for nobody:
[sudo] password for nobody:
failed.

Making gpio utility failed.
Please check install.log and fix any problems. If you're still stuck,
then please open a new issue then post all the output and as many details as you can to
https://github.com/eugeneware/wiring-pi/issues

done.

How to solve it? What is the password for nobody?
Thanks!

New version to support Raspbian kernel 4.9.y ?

Hi,
I see that the guys @ https://github.com/raspberrypi/linux have changed the Linux headers default branch to 4.9.y, and are expecting this to be the new Long Term Support (LTS) version. This causes an issue for wiring-pi when using a 4.9.y Raspbian kernel, as the kernel (correctly) reports the hardware on a Pi3 as 'BCM2835', but this generates an error message regarding unsupported hardware in wiring-pi. It appears Gordon Henderson fixed this issue some time ago in the C library for wiringPi (http://wiringpi.com), but your Node wrapper builds against a rather out of date mirror at https://github.com/nekuz0r/wiringpi.git.
Do you plan to resolve this ?
Regards,
George

npm install wiring-pi on jessie fails

Hello All,

I have a Raspberry PI 2 with installed wiring-pi. Here is what gpio -v logs:

gpio -v
gpio version: 2.25
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Model 2, Revision: 1.1, Memory: 1024MB, Maker: Sony 

I want to use wiring-pi in a node.js program so I tried npm install wiring-pi and here it what happens:

npm install wiring-pi

> [email protected] install /data/shared/Developing/ledconodel/node_modules/wiring-pi
> /bin/bash ./install.sh

Cloning libWiringPi ... done.
patching file ./wiringpi/devLib/Makefile
Hunk #1 succeeded at 24 with fuzz 1 (offset -2 lines).
Hunk #2 succeeded at 32 with fuzz 2 (offset -2 lines).
patching file ./wiringpi/gpio/Makefile
Making libWiringPi ... failed.

================================================================================
FATAL: Making libWiringPi failed.
Please check install.log and fix any problems. If you're still stuck,
then please open a new issue then post all the output and as many details as you can to
  https://github.com/WiringPi/WiringPi-Node/issues
================================================================================

npm ERR! Linux 4.4.38-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "wiring-pi"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `/bin/bash ./install.sh`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script '/bin/bash ./install.sh'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the wiring-pi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     /bin/bash ./install.sh
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs wiring-pi
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls wiring-pi
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /data/shared/Developing/ledconodel/npm-debug.log

I also attached the full npm debug log in hope someone can tell me whats going wrong.

Please, could someone help me?

Best regards,

Chris

npm-debug.log.zip

Exception: ../src/addon.cc:30:3: error: ‘ThrowException’ is not a member of ‘v8’

When installing wiring-pi 2.0.0 I get multiple exceptions, most related to the V8 namespace, is there some dependency missing?

    Making wiring-pi ... child_process: customFds option is deprecated, use stdio instead.
    make: Entering directory '/home/pi/piCtrl/node_modules/wiring-pi/build'
      CXX(target) Release/obj.target/wiringPi/src/addon.o
    ../src/addon.cc: In function ‘void throw_error(const char*, ...)’:
    ../src/addon.cc:30:3: error: ‘ThrowException’ is not a member of ‘v8’
    ../src/addon.cc:30:43: error: ‘New’ is not a member of ‘v8::String’
    wiringPi.target.mk:126: recipe for target 'Release/obj.target/wiringPi/src/addon.o' failed
    make: *** [Release/obj.target/wiringPi/src/addon.o] Error 1
    make: Leaving directory '/home/pi/piCtrl/node_modules/wiring-pi/build'
    gyp ERR! build error
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
    gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
    gyp ERR! System Linux 3.18.5+
    gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /home/pi/piCtrl/node_modules/wiring-pi
    gyp ERR! node -v v0.12.0
    gyp ERR! node-gyp -v v1.0.2
    gyp ERR! not ok

Tested on both Raspberry B and Raspberry 2 B running raspbian.
Also tested Node v0.12 & v0.11.9

Cannot build on node v5.3.0, gcc 4.6.3

When using npm install wiring-pi, the following errors occur:

Cloning libWiringPi ... done.
patching file ./wiringpi/devLib/Makefile
Hunk #1 succeeded at 24 with fuzz 1 (offset -2 lines).
Hunk #2 succeeded at 32 with fuzz 2 (offset -2 lines).
patching file ./wiringpi/gpio/Makefile
Making libWiringPi ... done.
Making devLib ...done.
Unistalling gpio utility ... done.
Making gpio utility ... done.
Installing gpio utility ... done.
Making wiring-pi ... make: Map '/root/tmp/node_modules/wiring-pi/build' wordt binnengegaan
  CXX(target) Release/obj.target/wiringPi/src/addon.o
In file included from ../src/addon.h:4:0,
                 from ../src/addon.cc:1:
/root/.node-gyp/5.3.0/include/node/v8.h:336:1: error: expected unqualified-id before ‘using’
/root/.node-gyp/5.3.0/include/node/v8.h:469:1: error: expected unqualified-id before ‘using’
/root/.node-gyp/5.3.0/include/node/v8.h:856:1: error: expected unqualified-id before ‘using’
In file included from ../src/addon.cc:1:0:
../src/addon.h:12:24: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:12:44: error: expected primary-expression before ‘>’ token
../src/addon.h:12:46: error: ‘val’ was not declared in this scope
../src/addon.h:13:28: error: redefinition of ‘bool node::Buffer::HasInstance’
../src/addon.h:12:12: error: ‘bool node::Buffer::HasInstance’ previously defined here
../src/addon.h:13:24: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:13:45: error: expected primary-expression before ‘>’ token
../src/addon.h:13:47: error: ‘val’ was not declared in this scope
../src/addon.h:14:18: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:14:38: error: expected primary-expression before ‘>’ token
../src/addon.h:14:40: error: ‘val’ was not declared in this scope
../src/addon.h:15:22: error: redefinition of ‘char* node::Buffer::Data’
../src/addon.h:14:13: error: ‘char* node::Buffer::Data’ previously defined here
../src/addon.h:15:18: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:15:39: error: expected primary-expression before ‘>’ token
../src/addon.h:15:41: error: ‘val’ was not declared in this scope
../src/addon.h:16:21: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:16:41: error: expected primary-expression before ‘>’ token
../src/addon.h:16:43: error: ‘val’ was not declared in this scope
../src/addon.h:17:25: error: redefinition of ‘size_t node::Buffer::Length’
../src/addon.h:16:14: error: ‘size_t node::Buffer::Length’ previously defined here
../src/addon.h:17:21: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:17:42: error: expected primary-expression before ‘>’ token
../src/addon.h:17:44: error: ‘val’ was not declared in this scope

Using the latest node version (5.3.0) and gcc 4.6.3

build failure on "wheezy"

I'm trying to get going with WiringPi on my Raspberry Pi 2. I have a build failure. Am I doing something wrong?

Here is the failure:
pi@raspberrypi ~/src/testNpmWiringPi $ npm install wiring-pi

[email protected] install /home/pi/src/testNpmWiringPi/node_modules/wiring-pi
/bin/bash ./install.sh

Cloning libWiringPi ... done.
patching file ./wiringpi/devLib/Makefile
Hunk #1 succeeded at 24 with fuzz 1 (offset -2 lines).
Hunk #2 succeeded at 32 with fuzz 2 (offset -2 lines).
patching file ./wiringpi/gpio/Makefile
Making libWiringPi ... done.
Making devLib ...done.
Unistalling gpio utility ... done.
Making gpio utility ... done.
Installing gpio utility ... done.
Making wiring-pi ... gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
make: Entering directory '/home/pi/src/testNpmWiringPi/node_modules/wiring-pi/build'
CXX(target) Release/obj.target/wiringPi/src/addon.o
In file included from ../src/addon.h:4:0,
from ../src/addon.cc:1:
/home/pi/.node-gyp/7.5.0/include/node/v8.h:346:1: error: expected unqualified-id before ‘using’
/home/pi/.node-gyp/7.5.0/include/node/v8.h:849:1: error: expected unqualified-id before ‘using’
/home/pi/.node-gyp/7.5.0/include/node/v8.h:5578:35: error: ‘virtual v8::EmbedderHeapTracer::~EmbedderHeapTracer()’ declared virtual cannot be defaulted in the class body
In file included from ../src/addon.cc:1:0:
../src/addon.h:12:24: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:12:44: error: expected primary-expression before ‘>’ token
[snip] (a lot more errors in this file)
wiringPi.target.mk:135: recipe for target 'Release/obj.target/wiringPi/src/addon.o' failed
make: *** [Release/obj.target/wiringPi/src/addon.o] Error 1
make: Leaving directory '/home/pi/src/testNpmWiringPi/node_modules/wiring-pi/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/pi/.nvm/versions/node/v7.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:192:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.1.19-v7+
gyp ERR! command "/home/pi/.nvm/versions/node/v7.5.0/bin/node" "/home/pi/.nvm/versions/node/v7.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/src/testNpmWiringPi/node_modules/wiring-pi
gyp ERR! node -v v7.5.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok

gcc version is:
gcc (Debian 4.6.3-14+rpi1) 4.6.3

Cleanup

Is there a method to cleanup the pins so they aren't left in an on state when a program ends?

pinModeAlt not working as it should

Wanting to set the alt modes of pins I tried to use this function to set the ALT0 (4) mode of a pin finding that it does not work. This because the modes are limited to WPI_MODE_PINS (0), WPI_MODE_PHYS (3), WPI_MODE_GPIO (1-GPIO_OUTPUT). These three constands are to specify how the pin numbers arguments are translated and have nothing to do with the operational mode of a pin. Instead the following defines from wiringPi.c should be used:
FSEL_INPT (0)
FSEL_OUTP (1)
FSEL_ALT0 (4)
FSEL_ALT1 (5)
FSEL_ALT2 (6)
FSEL_ALT3 (7)
FSEL_ALT4 (3)
FSEL_ALT5 (2)

Can't build wiring-pi (node v5.4.1, gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3)

I'm contributing to a project, that's using travis to validate the pull requests. Now I see this problem on travis, but I can't reproduce it on my raspi (stactrace below).

Note that this problem occured after the maintainer updated Node and various other dependencies of the project. A update to the same versions of node and npm on my host just went fine.

$ node --version
v5.4.1
$ npm --version
3.3.12
$ nvm --version
0.23.3

Stactrace of build https://travis-ci.org/alexbain/lirc_web/builds/102908922 (see raw output for the full build log):

Cloning libWiringPi ... done.
patching file ./wiringpi/devLib/Makefile
Hunk #1 succeeded at 24 with fuzz 1 (offset -2 lines).
Hunk #2 succeeded at 32 with fuzz 2 (offset -2 lines).
patching file ./wiringpi/gpio/Makefile
Making libWiringPi ... done.
Making devLib ...done.
Unistalling gpio utility ... done.
Making gpio utility ... done.
Installing gpio utility ... done.
Making wiring-pi ... make: Entering directory `/home/travis/build/alexbain/lirc_web/node_modules/wiring-pi/build'
  CXX(target) Release/obj.target/wiringPi/src/addon.o
In file included from ../src/addon.h:4:0,
                 from ../src/addon.cc:1:
/home/travis/.node-gyp/5.4.1/include/node/v8.h:336:1: error: expected unqualified-id before ‘using’
/home/travis/.node-gyp/5.4.1/include/node/v8.h:469:1: error: expected unqualified-id before ‘using’
/home/travis/.node-gyp/5.4.1/include/node/v8.h:856:1: error: expected unqualified-id before ‘using’
In file included from ../src/addon.cc:1:0:
../src/addon.h:12:24: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:12:44: error: expected primary-expression before ‘>’ token
../src/addon.h:12:46: error: ‘val’ was not declared in this scope
../src/addon.h:13:28: error: redefinition of ‘bool node::Buffer::HasInstance’
../src/addon.h:12:12: error: ‘bool node::Buffer::HasInstance’ previously defined here
../src/addon.h:13:24: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:13:45: error: expected primary-expression before ‘>’ token
../src/addon.h:13:47: error: ‘val’ was not declared in this scope
../src/addon.h:14:18: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:14:38: error: expected primary-expression before ‘>’ token
../src/addon.h:14:40: error: ‘val’ was not declared in this scope
../src/addon.h:15:22: error: redefinition of ‘char* node::Buffer::Data’
../src/addon.h:14:13: error: ‘char* node::Buffer::Data’ previously defined here
../src/addon.h:15:18: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:15:39: error: expected primary-expression before ‘>’ token
../src/addon.h:15:41: error: ‘val’ was not declared in this scope
../src/addon.h:16:21: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:16:41: error: expected primary-expression before ‘>’ token
../src/addon.h:16:43: error: ‘val’ was not declared in this scope
../src/addon.h:17:25: error: redefinition of ‘size_t node::Buffer::Length’
../src/addon.h:16:14: error: ‘size_t node::Buffer::Length’ previously defined here
../src/addon.h:17:21: error: ‘Handle’ is not a member of ‘v8’
../src/addon.h:17:42: error: expected primary-expression before ‘>’ token
../src/addon.h:17:44: error: ‘val’ was not declared in this scope
make: *** [Release/obj.target/wiringPi/src/addon.o] Error 1
make: Leaving directory `/home/travis/build/alexbain/lirc_web/node_modules/wiring-pi/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/travis/.nvm/versions/node/v5.4.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.13.0-63-generic
gyp ERR! command "/home/travis/.nvm/versions/node/v5.4.1/bin/node" "/home/travis/.nvm/versions/node/v5.4.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/travis/build/alexbain/lirc_web/node_modules/wiring-pi
gyp ERR! node -v v5.4.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
done.

Question about analogRead pin docs

doc entry for reference: https://github.com/eugeneware/wiring-pi#wpianalogreadpin

I've got a gertboard and I'm trying to get it to talk to wiring-pi. The docs mention "You will need to register additional analog modules to enable this function for device such as the Gertboard, quick2Wire analog board, etc."

What "analog modules" is this referring to? Happen to have an example of how I might enable the gertboard module?

Fantastic work BTW. Thank you thank you thank you for working on this.

sn3218 extension not available

I'm using node v5.11.0 on a Raspberry PI 3, with gpio v2.32. I've added the wiring-pi via npm and while I can use the basic functions (for example wpi.wiringPiSetup()) when I try to run a simple test:
var wpi = require('wiring-pi'); var basePin = 64; wpi.wiringPiSetup(); wpi.sn3218Setup(basePin); wpi.analogWrite(1,255); console.log("Pin should be on");
I get TypeError: wpi.sn3218Setup is not a function. Is there some additional setup I'm missing for the extension?

Can not install

pi@raspberrypi ~/autocar $ npm rebuild

[email protected] install /home/pi/autocar/node_modules/wiring-pi
/bin/bash ./install.sh

Cloning libWiringPi ... done.
patching file ./wiringpi/devLib/Makefile
patching file ./wiringpi/gpio/Makefile
Making libWiringPi ... done.
Making devLib ...done.
Unistalling gpio utility ... done.
Making gpio utility ... done.
Installing gpio utility ... done.
Making wiring-pi ... make: Entering directory '/home/pi/autocar/node_modules/wiring-pi/build'
CXX(target) Release/obj.target/wiringPi/src/addon.o
../src/addon.cc: In function ‘void throw_error(const char_, ...)’:
../src/addon.cc:30:3: error: ‘ThrowException’ is not a member of ‘v8’
../src/addon.cc:30:43: error: ‘New’ is not a member of ‘v8::String’
wiringPi.target.mk:128: recipe for target 'Release/obj.target/wiringPi/src/addon.o' failed
make: *_* [Release/obj.target/wiringPi/src/addon.o] Error 1
make: Leaving directory '/home/pi/autocar/node_modules/wiring-pi/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.18.11-v7+
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/autocar/node_modules/wiring-pi
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
done.
Enjoy !
[email protected] /home/pi/autocar/node_modules/wiring-pi
[email protected] /home/pi/autocar/node_modules/async

Does this support orange pi zero?

Im getting this

root@orangepizero:~/src/node-wiring-op/examples# nodejs pwm.js
Unable to determine hardware version. I see: Hardware   : sun8i
,
 - expecting BCM2708 or BCM2709. Please report this to [email protected]
root@orangepizero:~/src/node-wiring-op/examples#

pinModeAlt mode is checked in wrong ints

Currently pinModeAlt mode argument is checked in (WPI_MODE_PINS, WPI_MODE_PHYS, WPI_MODE_GPIO) while it should be checked in (FSEL_INPT, FSEL_OUTP, FSEL_ALT0, FSEL_ALT1, FSEL_ALT2, FSEL_ALT3, FSEL_ALT4, FSEL_ALT5). DOCUMENTATION confirms this:

pinModeAlt(pin, mode)

>= 1.0.0

This is an un-documented special to let you set any pin to any mode.

mode can be one of the following values:

  • FSEL_INPT
    >= 2.1.0
  • FSEL_OUTP
    >= 2.1.0
  • FSEL_ALT0
    >= 2.1.0
  • FSEL_ALT1
    >= 2.1.0
  • FSEL_ALT2
    >= 2.1.0
  • FSEL_ALT3
    >= 2.1.0
  • FSEL_ALT4
    >= 2.1.0
  • FSEL_ALT5
    >= 2.1.0

Unable to open GPIO error

Hi when I start my program, quite often I get this error in the terminal:

wiringPiISR: unable to open /sys/class/gpio/gpio22/value: No such file or directory

Do you know what may cause this? Is it something to be wrong with my code or with wiring-pi?

Thanks

Stu

[Proposal] Throw "System Error" exceptions instead of returning ints

I would like to propose to switch from C style errors to node's exceptions. Node did so with libuv very long time ago. I can't even find the first commit with change from returning -1 to throwing exception ... Now augmented Errors are thrown all over node's source code: https://github.com/nodejs/node/blob/95ba482a8ee663a1333ccc52b372e81d39df7166/lib/util.js#L1021, https://github.com/nodejs/node/blob/db1087c9757c31a82c50a1eba368d8cba95b57d0/deps/npm/lib/utils/spawn.js#L33, https://github.com/nodejs/node/blob/7bc6aeac86e6ce09efba4b04190b7792fc72fded/lib/dns.js#L17 alot more can be found reading node's source.

System Errors are as well documented in the API Documentation.

Such change is needed for a lot of reasons but mainly because JavasSript, node, v8 and respectively C++ are not C. In C the only way to indicate that some function failed is to return anything other than 0 (there are historical reasons why 0 aka EXIT_SUCCESS means that no errors occurred during a function execution, most of which are related to how CPUs treats numbers, what negative numbers means to the kernel and how is this than delegate to the user ...) But in JavasSript, node, v8 and C++ there are exceptions and they exist because they can provide more information about what failed, give more descriptive human readable error message and also change control flow.

WiringPi is written in C and dose inherit the return code error mechanism but wiring-pi is written in C++ and is meant to act as glue between WiringPi and JavaScript which uses exceptions and not errno and so it must inherit from the JavaScript native error mechanism ...

So I want all functions that return -1 to indicate error to throw augmented Error instead. Which will as well save the user from redundant checking of errno which is not even exposed in node (only POSIX errno codes are, under global.os.constatns.errno) since is not meant to be checked from user JavaScript code ...

For example all functions that return opened file descriptor should throw Error with code and errno set to returned errno code name ('EACCES' for an example) and syscal to 'open'. Other examples could be serialDataAvail to only return the number of characters available for reading, or to throw for any error condition.

If this proposal get approved these is the task list than needs to be done:

I would also like to do all of the above and all other that is needed to move wirng-pi from returning -1 to throwing exceptions.

Can't get the last version thru npm install

Hi,
When using the npm install wirin-pi command I grad the version 2.0.0.
Since I'm using a RPI2 I'd like to get the 2.1.0 (since it seems to support the latest raspberry board). What is the best way to get the 2.1.0 ?

Thx,
G.

Does not work with Raspberry Pi 2

Can you please update the package to include gordon's new libraries for WiringPi? I believe you need at least version 24 to enable this to work correctly with the new raspberry Pi 2.

[Proposal] move the project to an open organization

I would like to propose to start an open organization named wiring-pi where npm packages related to WiringPi could be united. In order to split the wiring-pi package either into micro packages like wiring-pi-core, wring-pi-addon, wiring-pi-i2c and so on or into separate addons. Since most wring-pi users don't use the whole functionality in one project. This will drastically reduce wiring-pi size. The current model exports the whole WiringPi library in one addon which loads everything in the memory once the package is required ... Maybe there are users that need only SPI or I2C or Interrupt handlers and core functionality in one project ... (I'm currently developing a Object Oriented wrapper of wiring-pi and when I'm done, I'll create npm package for controlling am2320/1 from node which can be both moved in such case and other people may move their projects too).

I thing now is the perfect time for such thing and can play well with #60. As well creating a github page of the project can help increase the npm stats of the project.

Building on Windows

Is it possible to adjust the install script files in a way that allows building wiring-pi on Windows? Tried with Cygwin and / or MinGW on Windows 10, but it seems like the reference to /bin/bash is the main error here, which just can not be resolved by manipulating the PATH variable.

My aim is to use wiring-pi as part of a Node JS project aimed at Windows 10 IoT using NTVS (Node JS Tools for Visual Studio) together with an extension called NTVSIoT which basically represents an altered version of Node JS just with Microsoft's Chakra engine instead of V8.

not working with MCP23s17

Hi , I have been trying to write high to GPIOA0 on the MCP23s17 chip using the wiring-pi npm . The code is runing without errors but the the GPIOA0 pin is not turning high

Here is the code I used .

var wpi = require('wiring-pi');

wpi.setup('wpi');
var pin = 64;
wpi.mcp23s17Setup(pin, 0, 0)

wpi.pinMode(pin, wpi.OUTPUT);

setInterval(function() {
wpi.digitalWrite (pin, 1);
console.log(pin)
}, 500);

I have tried setting the pin value to 123 , 64 and even increment it from 64 to 140 but nothing happens to any gpio's on the MCP23s17 .

the reset is connected to 5v , clk , mosi , miso of the chip is connected to SCLK , mosi , miso on the pi receptively I have also tried connecting mosi on the chip with miso on the pi but that did do anything as well

Error: Module did not self-register

Hi!

I successfully installed wiring-pi on a Raspberry 2 Model B, but as soon as I try to use the library it throws the following error:

module.js:434
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: Module did not self-register.
    at Error (native)
    at Object.Module._extensions..node (module.js:434:18)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/pi/raspberry-realtime-test/node_modules/wiring-pi/lib/exports.js:1:80)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)

Here is the file test.js I'm trying to execute:
sudo node test.js

var wpi = require('wiring-pi');

How can I resolve this issue?

Program Version
node 4.4.2
npm 1.4.21
gcc 4.9.2

V8 fatal error

Hi.
While handling interrupt I've got the following error:
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope

My code is below:

var gpio = require('wiring-pi');
gpio.setup('wpi');

//inputs
var signalStartMovie= 7;
//outputs
var signalMovieEnded= 5;

gpio.pinMode(signalMovieEnded, gpio.OUTPUT);
gpio.pinMode(signalStartMovie, gpio.INPUT);
gpio.pullUpDnControl(signalStartMovie, gpio.PUD_UP);

gpio.wiringPiISR(7, gpio.INT_EDGE_FALLING, function(delta) {
    console.log("Interrupt!", delta);
    //gpio.wiringPiISRCancel(signalStartMovie);
});

setInterval(function () {
    gpio.digitalWrite(signalMovieEnded, gpio.HIGH);
    console.log(gpio.digitalRead(signalStartMovie));
    setTimeout(function () {
        gpio.digitalWrite(signalMovieEnded, gpio.LOW);
    }, 500);
}, 1000);

What is this? How to solve?

Eventlistener

Is there any Eventlistener available? If GPIOs state has changed trigger an action or something else, like this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.