The problem I'm having is that bonescript isn't building in Debian in Node 
0.10.x because of this issue:
https://github.com/jadonk/bonescript/issues/38

Also

npm install bonescript

fails trying to install bonescript 0.23, even though 0.24 is the latest on 
github.

I did have some luck getting bonescript to work on the BBB by doing the 
following
- download zip file from github and unzip it to my desktop
- create a "bonescript" directory in node_modules on the BBB
- copy all files in the bonescript-master/node_modules/bonescript directory 
to BBB node_modules/bonescript
- I did not include the subdirectories in the copy.  Instead I installed 
bonescripts various dependencies separately via npm

This worked for some of the limited things I tried, but I'm sure there must 
be a better way to do it (though everything else I tried bombed out in one 
way or another).

If Jason is lurking out there, his input would be appreciated  :-)

On Saturday, 28 September 2013 02:58:31 UTC-6, Will Kostelecky wrote:
>
> A little more on the above in hopes that Jason will see this!   Here is a 
> code sample using the i2c library from korevec that works:
>
> var i2c = require('i2c');       
> var address = 0x6A;
> var device = {device: '/dev/i2c-1', debug: false};
> var command = 0x80;
>
> var wire = new i2c(address, device); 
>
> wire.readBytes(0x80, 4, function(err, res) {
>     var voltageIn = (res[0] << 8) + res[1];
>     voltageIn = 5*(voltageIn / 2048);
>     console.log(res);
>     console.log(voltageIn);
> }); 
>
> Here is the output from the above:
>
> <Buffer 00 01 80 80>
> 0.00244140625
>
> Here is my conversion of the above to use the bonescript version:
>
> var b = require('bonescript');
>
> var address = 0x6A;
> var port = '/dev/i2c-1';
> var command = 0x80;
>
> b.i2cOpen(port, address);
>
> b.i2cReadBytes(port, command, 4, function(data) {
>     console.log(data);
>     console.log(data.res);
>     var voltageIn = (data.res[0] << 8) + data.res[1];
>     console.log(voltageIn);
>     console.log("------------");
> }); 
>
> Here is the output from the above:
>
> { err: [Error: Error reading length of bytes],
>   res: <Buffer 18 e6>,
>   event: 'callback' }
> <Buffer 18 e6>
> 6374
> ------------
> { event: 'return', return: <Buffer 18 e6> }
> undefined
> /home/root/chair/dev/sandbox.js:12
>     var voltageIn = (data.res[0] << 8) + data.res[1];
>                              ^
> TypeError: Cannot read property '0' of undefined
>
> I presume that I am doing something wrong but have not been able to find 
> an example that might help me decode the mystery.
>
> Cheers,
> Will
>
>
>
> On Saturday, 28 September 2013 09:07:03 UTC+1, Will Kostelecky wrote:
>>
>> DeKay:
>>
>> I just got back to this.  The instructions on GitHub implied that an opkg 
>> update, opkg install bonescript would give me the latest bonescript (which 
>> I would assume includes the i2c support) but it reported that my current 
>> version was up to date.   I then did an npm install bonescript and did get 
>> the version of bonescript with the i2c support.   Unfotunately I have not 
>> been able to get the code that works with the native i2c library from 
>> korevec to work with the bonescript version.   It opens the source but when 
>> it goes to do the i2cReadBytes it bombs with no error and no nuttin.
>>
>> Using the library directly does what I need and bonescript doesnt really 
>> offer me anything so I am not sure I will go further with it.  I would note 
>> that the korevec library does cause segmentation faults when reading an 
>> ADC.   I have posted this as an issue on GitHub and am not sure if it is 
>> the code...or me...
>>
>> Will
>>
>> On Thursday, 12 September 2013 19:41:14 UTC+1, DeKay wrote:
>>>
>>> Hi Will.
>>>
>>> Please post a writeup of how to update bonescript from GitHub if you get 
>>> this working.  I'd like to get this going but am very much a node noob and 
>>> would have a heck of a time trying to figure out what might be wrong if 
>>> something beyond a simple "git clone ..." within the node_modules directory 
>>> didn't work.
>>>
>>> On Wednesday, 11 September 2013 23:30:59 UTC-6, Will Kostelecky wrote:
>>>>
>>>> I have used node-i2c from korevec somewhat successfully but was 
>>>> interested to see references to it now being included within bonescript 
>>>> (specifically 
>>>> on GitHub in here <https://github.com/jadonk/bonescript>).  This is 
>>>> still not included in the regular image as of the latest out there but it 
>>>> seems you can update bonescript from the github link yourself.   I am in 
>>>> the middle of doing that now....
>>>>
>>>> Will
>>>>
>>>> On Monday, 27 May 2013 03:21:38 UTC+1, Jason Stapels wrote:
>>>>>
>>>>> A couple of us have been using this node module with some success:
>>>>>
>>>>> https://github.com/korevec/node-i2c
>>>>>
>>>>> I've used it to communicate to an MPU-6050.
>>>>>
>>>>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to