sandeepmistry / node-chip-io

Johnny-Five IO Plugin for the Next Thing Co. C.H.I.P.
MIT License
96 stars 28 forks source link

example onboard-button.js #29

Closed rootedsoftware closed 7 years ago

rootedsoftware commented 7 years ago

If I try to use var chipio = require('chip-io'); I get an error

1480649763736 Connected C.H.I.P.  
1480649763812 Repl Initialized  
>> /home/chip/easy-button/index.js:10
  var onboardButton = new chipio.OnboardButton();
                      ^

TypeError: chipio.OnboardButton is not a constructor
    at Board.<anonymous> (/home/chip/easy-button/index.js:10:23)
    at emitNone (events.js:91:20)
    at Board.emit (events.js:185:7)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

I think the example is missing some parts in the readme

chris-gunawardena commented 7 years ago

Try this:

var Chip_io = require('chip-io');
var chip_io = new Chip_io();
var onboardButton = chip_io.OnboardButton();
sandeepmistry commented 7 years ago

@c316 so the onboard button support is not published to npm yet, so unless you clone from Gtihub or install via npm install sandeepmistry/node-chip-io it will not be present.

Please try this and let me know what the result is. Closing this for now.