Responding to a query you made privately.... Try clearing the npm cache and setting the install path. The root user environment doesn't seem quite right.
TERM=none sudo npm cache clear TERM=none sudo npm install -g --prefix /usr/local --unsafe-perm bonescript On Thu, Mar 1, 2018 at 2:38 PM Fred Kerr <[email protected]> wrote: > Great, thanks! I was just choosing some pins to connect to the light bar. > I had initially wired it up to an Arduino101 to amuse my ~4 - year old son. > > I'm just grabbing things out of my parts that I have available and as time > permits. > > I started playing with a small solar cell as an input to 1.8v analog input. > > I don't have enough fluency in javascript right now so I should probably > switch to python. I will eventually want to use a c/c++ library. > > I just found the reference to the Cape last night. > > When I get to my laptop or desktop I plan to check on something. I think > P2_36 has a P2_35 typo in one of the tables. > > Fred Kerr (mobile) > > > On Mar 1, 2018 9:32 AM, "Jason Kridner" <[email protected]> > wrote: > > Thanks for the issue report and test code. It helped me verify the fix for > shiftOut.js. Indeed it got broken some time back and it seems no one tried > using the function. > > Anyway, it is now fixed in 0.6.3. > > Install via 'sudo npm install -g --unsafe-perm bonescript'. > > I tested with the BaconBits PocketCape on PocketBeagle: > https://plus.google.com/u/1/+JasonKridner/posts/14ij5UkGLwY > https://gist.github.com/jadonk/4557087c543e2ba29ca824badd1d4aa8 > > I adjusted your code a bit for the BaconBits hardware: > * nCS was on a different pin > * Addressing was a bit different than you seem to have planned > > It starts up a bit slow, but it works. > > On Wed, Feb 28, 2018 at 9:38 PM Fred Kerr <[email protected]> wrote: > >> Thanks Jason, >> >> I don't currently need javascript; I'm just exploring the examples. I may >> need it in the future for some things, TBD. :) >> >>> reset.js just contains this: >>> >>> >> >>> //# fekerr 20180227 >>> //# >>> https://github.com/beagleboard/pocketbeagle/wiki/System-Reference-Manual#221_PocketBone >>> >>> var b = require('bonescript'); >>> >>> var LE = "P2_33" ; // GPIO45 >>> var SPI = "P2_25"; // MOSI >>> var CLK = "P2_29"; // CLK >>> >>> var chip = [0, 0, 0, 0, 0, 0]; // 44 outputs, 5 1/2 chips >>> >>> // Configure pins as outputs >>> b.pinMode(LE, b.OUTPUT); >>> b.pinMode(SPI, b.OUTPUT); >>> b.pinMode(CLK, b.OUTPUT); >>> >>> // initial states >>> b.digitalWrite(LE, b.LOW); >>> b.digitalWrite(SPI, b.LOW); >>> b.digitalWrite(CLK, b.LOW); >>> >>> doUpdate(); >>> >>> function doUpdate() >>> { >>> var i; >>> b.digitalWrite(LE, b.LOW); >>> for(i=0; i<6; ++i) >>> { >>> b.shiftOut(SPI, CLK, b.MSBFIRST, chip[i]); >>> } >>> b.digitalWrite(LE, b.HIGH); >>> } >>> >>> >>> >>> debian@beaglebone:/usr/local/lib/node_modules/bonescript/src$ ls -rtl >> total 232 >> -rw-r--r-- 1 debian debian 6000 Jan 12 21:11 socket_handlers.js >> -rw-r--r-- 1 debian debian 2190 Jan 12 21:11 server.js >> -rw-r--r-- 1 debian debian 680 Jan 12 21:11 serial.js >> -rw-r--r-- 1 debian debian 1639 Jan 12 21:11 rc.js >> -rw-r--r-- 1 debian debian 3777 Jan 12 21:11 parse.js >> -rw-r--r-- 1 debian debian 17253 Jan 12 21:11 my.js >> -rw-r--r-- 1 debian debian 1063 Jan 12 21:11 iic.js >> -rw-r--r-- 1 debian debian 9873 Jan 12 21:11 hw_universal.js >> -rw-r--r-- 1 debian debian 2940 Jan 12 21:11 hw_simulator.js >> -rw-r--r-- 1 debian debian 6039 Jan 12 21:11 hw_oldkernel.js >> -rw-r--r-- 1 debian debian 13019 Jan 12 21:11 hw_mainline.js >> -rw-r--r-- 1 debian debian 14571 Jan 12 21:11 hw_capemgr.js >> -rw-r--r-- 1 debian debian 4349 Jan 12 21:11 functions.js >> -rw-r--r-- 1 debian debian 11980 Jan 12 21:11 eeprom.js >> -rw-r--r-- 1 debian debian 393 Jan 12 21:11 constants.js >> -rw-r--r-- 1 debian debian 4596 Jan 12 21:11 bonescript.js >> -rw-r--r-- 1 debian debian 69177 Jan 12 21:11 bone.js >> -rw-r--r-- 1 debian debian 4394 Jan 12 21:11 autorun.js >> -rw-r--r-- 1 debian debian 19763 Feb 28 00:26 index.js >> >> ... >> >> index.js, lines 1-5: >> // Copyright (C) 2011 - Texas Instruments, Jason Kridner >> 2 // >> 3 // >> 4 var fs = require('fs'); >> 5 var child_process = require('child_process'); >> ... >> lines pi-hundred to 333: >> >> } else if(clock == 2) { >> 315 i++; >> 316 clock = 0; >> 317 f.digitalWrite(clockPin, g.LOW, next); >> 318 } >> 319 } >> 320 >> 321 if(callback) { >> 322 next(); >> 323 } else { >> 324 for(i = 0; i < 8; i++) { >> 325 //fekerr 20180227 if(bitOrder == b.LSBFIRST) { >> 326 if(bitOrder == g.LSBFIRST) { >> 327 bit = val & (1 << i); >> 328 } else { >> 329 bit = val & (1 << (7 - i)); >> 330 } >> 331 >> 332 if(bit) { >> 333 f.digitalWrite(dataPin, g.HIGH); >> >> >> -- >> 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]. >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beagleboard/fb99d181-0e09-4e0d-bfff-e1f4fa8ca065%40googlegroups.com >> <https://groups.google.com/d/msgid/beagleboard/fb99d181-0e09-4e0d-bfff-e1f4fa8ca065%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > https://beagleboard.org/about > > -- > For more options, visit http://beagleboard.org/discuss > --- > > You received this message because you are subscribed to a topic in the > Google Groups "BeagleBoard" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/beagleboard/iT3JsATQIjI/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beagleboard/CA%2BT6QPmutJYGDnG1uH%2Bg9zkJ-yignn1AnCS4YUp6Y0WfXq%2BT1A%40mail.gmail.com > <https://groups.google.com/d/msgid/beagleboard/CA%2BT6QPmutJYGDnG1uH%2Bg9zkJ-yignn1AnCS4YUp6Y0WfXq%2BT1A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > > For more options, visit https://groups.google.com/d/optout. > > > -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beagleboard/CA%2BaxsPb38vg88o8pKZNrF%2B61TEtnVssSvg2k5iTQEkyECd7mFQ%40mail.gmail.com > <https://groups.google.com/d/msgid/beagleboard/CA%2BaxsPb38vg88o8pKZNrF%2B61TEtnVssSvg2k5iTQEkyECd7mFQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- https://beagleboard.org/about -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CA%2BT6QPnWAW%2B%2BffVj_CJkOVBvzrGFuaGbqk1X%2BTiZWRbsoyBC0g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
