auron89
Posts: 31
Joined: Fri Oct 31, 2014 11:54 am
Location: Rome

nodejs sense hat

Tue Mar 08, 2016 10:48 am

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!

Heater
Posts: 12740
Joined: Tue Jul 17, 2012 3:02 pm

Re: nodejs sense hat

Tue Mar 08, 2016 11:39 am

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.

auron89
Posts: 31
Joined: Fri Oct 31, 2014 11:54 am
Location: Rome

Re: nodejs sense hat

Tue Mar 08, 2016 1:19 pm

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.

auron89
Posts: 31
Joined: Fri Oct 31, 2014 11:54 am
Location: Rome

Re: nodejs sense hat

Tue Mar 08, 2016 1:20 pm

my node version was
4.2.1

test.js and testSync.js produce the same output

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

shanereaume
Posts: 1
Joined: Sun Feb 19, 2017 6:25 pm

Re: nodejs sense hat

Sun Feb 19, 2017 6:33 pm

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.

ngmraspi
Posts: 2
Joined: Sun Mar 19, 2017 9:56 am

Re: nodejs sense hat

Tue Mar 21, 2017 2:33 pm

The application is having trouble opening the I2C and SPI busses. Is there a configuration prereq for this application to work?

Code: Select all

[email protected]:~/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

Return to “Astro Pi”