GrovePi+ and JavaScript

SO now that I have moved beyond the space problem, I have successfully run test programs with the various sensors under python and made modifications for my needs. Separately I have been working with some non-GrovePi Javascript.

I am now trying to merge the sensors with my Javascript. I am having trouble getting Javascript to run with the GrovePi. I found a sample case here

https://www.npmjs.com/package/node-grovepi

It appears that the node-grovepi install fails even when running sudo.

I have also tried it on the GrovePi provided boot image with a similar failure mode. I note that there seem to be some errors related to i2c during the node-grovepi install.

I am attaching my code file created from the sample code to run the light sensor and the output of the run.

I also attach the install log and the debug log create.

Thanks

Not sure why the logfiles got blocked. Trying again. Will adjust file extension if needed.

In my js file I realize that the value of the LIGHT_SENSOR needs to be set, but I do not think that is the problem at this point. Also I don’t know if the function onLight needs to be defined or is part of the library at this point… again the issue seems to be more fundamental to the library install.

logs with text extension

Lastly a pointer to a working example of some sort would be very helpful. It may be there and I have not found it yet.

Thanks again, Chuck

Still wondering if there is any advice on running javascript on the GrovePi on RaspberryPi 2. It seems like there is some basic support in the distribution but I have not had any luck getting it to work. Any pointers or thoughts would be appreciated.

Hey Chucko, just to be clear, are we talking about Nodejs?

Yes. I tried to fire up the code included. The example on the web (and github) gave me a basic idea of how it should work, but no joy on the install of node-grovepi. Upon consideration perhaps it was targeted for the RPi1? and never ported to the RPi2?

Hey chucko, I just alerted Marcello who is the expert here. I can’t guarantee he’ll show up, but hopefully!

One way you might be able to bring the issue up as well is to submit a ticket on the NodeJs section of Github. Just a though!

Hi chucko,
actually there are known troubles with the I2C module and the Rpi2 (or the latest version of Node.js, 0.12.x). I’ve refactored the node-grovepi module in order to fix these issues (plus, there are other tweaks that I can share with you later). This new version of the module is scheduled to be released in the next days, I’m doing some tests but, in the meanwhile, you can contact me at marcello.barile@gmail.com and I’ll send you back a procedure to install the new module from the branch on my personal github.

Best regards

Great. Thanks guys. I will connect right now.

Thanks for the help. The new release seems to have done the trick. I did need to jun as “sudo”

A little bit of a mystery why my board version is coming back as 255.255.255 in JavaScript and Python, but I have what I need working in JavaScript now. I am running node 0.12.4. Node 0.11.9 was not particularly happy.

Thanks

Hi Chucko,
I was wondering that a firmware update may help :slight_smile: Let me know.