Skip to content

Commit

Permalink
Accelerometer: remove unnecessary array path for analogInitialize; Up…
Browse files Browse the repository at this point in the history
…date ESPLORA controller to assign pins correctly.

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Jul 12, 2016
1 parent 4f9a69f commit b92855d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/accelerometer.js
Expand Up @@ -17,14 +17,13 @@ var calibrationSize = 10;
var axes = ["x", "y", "z"];

function analogInitialize(opts, dataHandler) {
var pins = opts.pins || [],
state = priv.get(this),
dataPoints = {};
var state = priv.get(this);
var dataPoints = {};

state.zeroV = opts.zeroV || this.DEFAULTS.zeroV;
state.sensitivity = opts.sensitivity || this.DEFAULTS.sensitivity;

pins.forEach(function(pin, index) {
this.pins.forEach(function(pin, index) {
this.io.pinMode(pin, this.io.MODES.ANALOG);
this.io.analogRead(pin, function(data) {
var axis = axes[index];
Expand Down Expand Up @@ -619,7 +618,7 @@ var Controllers = {
},
initialize: {
value: function(opts, dataHandler) {
opts.pins = [5, 11, 6];
this.pins = [5, 11, 6];
analogInitialize.call(this, opts, dataHandler);
}
},
Expand Down

0 comments on commit b92855d

Please sign in to comment.