rwaldron / galileo-io

Intel Galileo & Intel Edison IO Plugin for Johnny-Five
http://johnny-five.io
MIT License
101 stars 26 forks source link

analogRead throws error on Gen 2 #17

Closed ryoshu closed 9 years ago

ryoshu commented 9 years ago

Using firmware 1.0.2 with the IoT DevKit latest.

var Galileo = require("galileo-io");
var board = new Galileo();
var pin = "A0";
board.on("ready", function() {
  console.log("READY");
  this.pinMode(pin, this.MODES.ANALOG);
  this.analogRead(pin, function(data) {
    console.log(data);
  });
});

root@quark016d09:~/projects/coral-test# node analogRead.js READY

/home/root/projects/coral-test/node_modules/galileo-io/lib/galileo.js:84 processRead(board, report, board.pins[report.index].read()); ^ TypeError: Object # has no method 'read' at /home/root/projects/coral-test/node_modules/galileo-io/lib/galileo.js:84:61 at Array.forEach (native) at Object.read as _onImmediate at processImmediate as _immediateCallback

rwaldron commented 9 years ago

Interesting. Let's find out what changed!

rwaldron commented 9 years ago

I just updated the mraa bindings used by Galileo-IO to the latest release and tested all 6 analog inputs. The only issue I found was that the latest version of the bindings are producing a 10bit ADC value instead of 12 (which matches Arduino)

rwaldron commented 9 years ago

@sethismyfriend try v0.3.5

ryoshu commented 9 years ago

Closing. Works after last update.

rwaldron commented 9 years ago

:clap:

rwaldron commented 9 years ago

This bug makes complete sense now.