bean-io icon indicating copy to clipboard operation
bean-io copied to clipboard

Problem trying to make it work.

Open danielfilho opened this issue 11 years ago • 6 comments

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.

danielfilho avatar Dec 23 '14 20:12 danielfilho

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

monteslu avatar Dec 23 '14 20:12 monteslu

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:

danielfilho avatar Dec 26 '14 02:12 danielfilho

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.

monteslu avatar Dec 29 '14 16:12 monteslu

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

thanks for sharing.

danielfilho avatar Dec 29 '14 19:12 danielfilho

give version bean-io version 0.2.0 a spin

monteslu avatar Jan 12 '15 11:01 monteslu

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

thanks so far :)

danielfilho avatar Jan 12 '15 17:01 danielfilho