Page 1 of 1

nodejs sense hat

Posted: Tue Mar 08, 2016 10:48 am
by auron89
hi guys ,do you know any library to display values from the sense -hat using Node.js ?
https://www.raspberrypi.org/products/sense-hat/

I tried using nodeimu (https://www.npmjs.com/package/nodeimu)
but can not find the necessary files to the operation do you have any other suggestions ?

Thank you all!

Re: nodejs sense hat

Posted: Tue Mar 08, 2016 11:39 am
by Heater
auron89,

What do you mean "...can not find the necessary files to the operation..."?

Do you have node.js installed?

Code: Select all

$ sudo apt-get install nodejs 
Do you have git installed? (Can't recall if git is installed out of the box on Raspbian)

Code: Select all

$ sudo apt-get install git 
Did you follow the instructions for installing nodeimu ?

Be sure you are in the nodeimu directory at this point.

Code: Select all

 
$ git clone https://github.com/rupnikj/nodeimu --recursive && cd nodeimu
$ npm install node-gyp -g
$ npm install
$ node test.js
The test should run.

Code: Select all

 
node testSync.js
Those tests are right there in the nodeimu directory.

I see no documentation on how to use this but everything you need to know can be found by reading test.js and testSync.js. It's not complicated.

Re: nodejs sense hat

Posted: Tue Mar 08, 2016 1:19 pm
by auron89
I 've followed all the steps from the library

I get this error
Error: Cannot find module './out/NodeIMU'


but I must say I have not installed Node.js by apt -get it from another source.

Re: nodejs sense hat

Posted: Tue Mar 08, 2016 1:20 pm
by auron89
my node version was
4.2.1

test.js and testSync.js produce the same output

Error: Cannot find module './out/NodeImu'

Re: nodejs sense hat

Posted: Sun Feb 19, 2017 6:33 pm
by shanereaume
The error you are getting is related to the version of node, npm install was not done on the application and/or because of the issue with nodejs not linked to "node".

I fixed the issue by installing node with nvm (https://github.com/creationix/nvm) and was able to get a new version of node (7.5) so I can use the latest JavaScript. That also fixed this issue for me.

I take it when you did the npm install step against your nodeimu repository it failed due to older node version and you did not realize or the issues with nodejs vs node that is common in Ubuntu. The nvm fixes that clusterfudge.

Re: nodejs sense hat

Posted: Tue Mar 21, 2017 2:33 pm
by ngmraspi
The application is having trouble opening the I2C and SPI busses. Is there a configuration prereq for this application to work?

Code: Select all

pi@raspberrypi:~/SourceProjects/nodeimu $ node test.js
Settings file RTIMULib.ini loaded
Failed to open I2C bus 1
Failed to open SPI bus 0, select 0
Failed to open SPI bus 0, select 1
No IMU detected
Using fusion algorithm RTQF
Failed to open SPI bus 0, select 1
No pressure sensor detected
Failed to open SPI bus 0, select 1
No humidity sensor detected
No IMU found