Giter VIP home page Giter VIP logo

nodejs-adcpi's People

Contributors

rjd22 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

nodejs-adcpi's Issues

Having trouble taking readings outside of 'setInterval'

Hi there,

Thanks for your the work on nodejs-adcpi. I've hit an interesting snag. Consider the following code snippet:

var MCP3424 = require('mcp3424'),
address = 0x6E,
gain = 0,
resolution = 3,
mcp = new MCP3424(address, gain, resolution, '/dev/i2c-1');

console.log(mcp.getMv(0));
setInterval(function() {
    console.log(mcp.getMv(0));
}, 1000);

The output will be as follows:

undefined
2047.984375
2047.984375
...

Note the undefined. Any idea what I might be doing wrong to end up with undefined outside of the setInterval?

Thanks!

can't install

CXX(target) Release/obj.target/i2c/src/i2c.o
../src/i2c.cc: In function ‘void setAddress(int8_t)’:
../src/i2c.cc:23:81: error: no matching function for call to ‘v8::Exception::TypeError(v8::MaybeLocalv8::String)’
Exception::TypeError(String::NewFromUtf8(isolate, "Failed to set address"))

and many more errors during installation

not installing on Raspberry Pi 3

Hi there,

I'm trying to install this package onto my Raspberry Pi 3 but I'm not successful :( This is what the terminal says:

pi@raspberrypi:~ $ sudo npm install nodejs-adcpi
-
> [email protected] install /home/pi/node_modules/nodejs-adcpi/node_modules/i2c
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/4.6.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp"
make: Entering directory '/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/build'
  CXX(target) Release/obj.target/i2c/src/i2c.o
../src/i2c.cc: In function ‘void ReadBlock(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/i2c.cc:162:47: error: no matching function for call to ‘New(int32_t&)’
   Local<Object> buffer = node::Buffer::New(len);
                                               ^
../src/i2c.cc:162:47: note: candidates are:
In file included from ../src/i2c.cc:2:0:
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, size_t)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                        ^
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:31:40: note:   candidate expects 2 arguments, 1 provided
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:34:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:34:40: note:   candidate expects 3 arguments, 1 provided
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:39:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t, node::Buffer::FreeCallback, void*)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:39:40: note:   candidate expects 5 arguments, 1 provided
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:46:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:46:40: note:   candidate expects 3 arguments, 1 provided
i2c.target.mk:92: recipe for target 'Release/obj.target/i2c/src/i2c.o' failed
make: *** [Release/obj.target/i2c/src/i2c.o] Error 1
make: Leaving directory '/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276: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:211:12)
gyp ERR! System Linux 4.4.32-v7+
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/node_modules/nodejs-adcpi/node_modules/i2c
gyp ERR! node -v v4.6.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm ERR! Linux 4.4.32-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "nodejs-adcpi"
npm ERR! node v4.6.2
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the i2c package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs i2c
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls i2c
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/npm-debug.log
pi@raspberrypi:~ $ sudo npm install nodejs-adcpi
-
> [email protected] install /home/pi/node_modules/nodejs-adcpi/node_modules/i2c
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/4.6.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp"
make: Entering directory '/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/build'
  CXX(target) Release/obj.target/i2c/src/i2c.o
../src/i2c.cc: In function ‘void ReadBlock(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/i2c.cc:162:47: error: no matching function for call to ‘New(int32_t&)’
   Local<Object> buffer = node::Buffer::New(len);
                                               ^
../src/i2c.cc:162:47: note: candidates are:
In file included from ../src/i2c.cc:2:0:
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, size_t)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                        ^
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:31:40: note:   candidate expects 2 arguments, 1 provided
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:34:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:34:40: note:   candidate expects 3 arguments, 1 provided
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:39:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t, node::Buffer::FreeCallback, void*)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:39:40: note:   candidate expects 5 arguments, 1 provided
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:46:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t)
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/.node-gyp/4.6.2/include/node/node_buffer.h:46:40: note:   candidate expects 3 arguments, 1 provided
i2c.target.mk:92: recipe for target 'Release/obj.target/i2c/src/i2c.o' failed
make: *** [Release/obj.target/i2c/src/i2c.o] Error 1
make: Leaving directory '/home/pi/node_modules/nodejs-adcpi/node_modules/i2c/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276: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:211:12)
gyp ERR! System Linux 4.4.32-v7+
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/node_modules/nodejs-adcpi/node_modules/i2c
gyp ERR! node -v v4.6.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm ERR! Linux 4.4.32-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "nodejs-adcpi"
npm ERR! node v4.6.2
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the i2c package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs i2c
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls i2c
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/npm-debug.log

I've tried installing node-gyp and it seems alright, but then I have these errors again. Any ideas? Thanks! :)

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.