monteslu / bean-io

Punchthrough LightBlue Bean IO for use with Johnny-five
22 stars 6 forks source link

Problem trying to make it work. #4

Open danielfilho opened 9 years ago

danielfilho commented 9 years ago

I've been struggling for a couple hours trying to find out what could be this error, but I just can't.

I've uploaded the firmata from Jacob Rosenthal, uploaded (it gave me an error, but on LightBlue Bean some ppl say it's ok). It appears linked on my Loader (see Sketch:firmata):

screen shot 2014-12-23 at 18 12 22

Then, I'm trying to run the "hello world" with the following code:

var beanio = require("bean-io");
var board = new beanio.Board({
  timeout: 30000 //optional - defaults to 30 seconds
  // uuid: 'myUuid' //optional - will use first bean found
});

board.on("ready", function() {
  console.log("CONNECTED");
  this.pinMode(13, this.MODES.OUTPUT);

  var byte = 0;

  // This will "blink" the on board led
  setInterval(function() {
    this.digitalWrite(13, (byte ^= 1));
  }.bind(this), 500);
});

but it gives me the following:

Scanning for BLE devices...
(scan)found:Bean 2 9ac2b27b3cdf4423a0b8638e97ceba2f
Stop Scanning for BLE devices...
connect bean 9ac2b27b3cdf4423a0b8638e97ceba2f
TypeError: Cannot call method 'discoverCharacteristics' of undefined
    at new Bean (/Users/danielfilho/dev/github/danielfilho/bean-io/node_modules/bean-io/node_modules/ble-bean/lib/bean.js:27:11)
    at /Users/danielfilho/dev/github/danielfilho/bean-io/node_modules/bean-io/lib/bean.js:31:30
    at Peripheral.<anonymous> (/Users/danielfilho/dev/github/danielfilho/bean-io/node_modules/bean-io/node_modules/noble/lib/peripheral.js:66:7)
    at Peripheral.g (events.js:180:16)
    at Peripheral.emit (events.js:95:17)
    at Noble.onServicesDiscover (/Users/danielfilho/dev/github/danielfilho/bean-io/node_modules/bean-io/node_modules/noble/lib/noble.js:198:16)
    at emit (events.js:98:17)
    at nobleBindings.discoverIncludedServices.args.kCBMsgArgDeviceUUID (/Users/danielfilho/dev/github/danielfilho/bean-io/node_modules/bean-io/node_modules/noble/lib/mac/mavericks.js:234:8)
    at emit (events.js:95:17)
    at nobleBindings.sendCBMsg.sendXpcMessage.kCBMsgId (/Users/danielfilho/dev/github/danielfilho/bean-io/node_modules/bean-io/node_modules/noble/lib/mac/mavericks.js:41:8)

I've npm install --save-dev johnny-five bean-io it. any idea?

ps: I've installed johnny-five, although I'm not using it yet. I want to run the basic to go through it later.

monteslu commented 9 years ago

thanks for the feedback. There's some fixes upstream in the works now that should make this better. ble-bean and noble have been updated, and bean-serial is being worked on. Will get a new version out ASAP

danielfilho commented 9 years ago

thank you so much for the feedback, I'll be waiting for that and keep my eyes on, to help whenever I can (and my skills allow me to).

:+1:

monteslu commented 9 years ago

Turns out there's been some changes in the most recent firmware. Older versions should still work, but the latest introduced a change to how serial data is transmitted: https://github.com/PunchThrough/bean-documentation/blob/master/serial_message_protocol.md

Should have some time this week to work on it.

danielfilho commented 9 years ago

awesome you've already mapped a possible cause for that problem. will keep my eyes on here :)

thanks for sharing.

monteslu commented 9 years ago

give version bean-io version 0.2.0 a spin

danielfilho commented 9 years ago

oh, I'm in US now and without my gadgets. in a couple weeks I'll give it a try.

thanks so far :)