var five = require('johnny-five');

var scalingRange = [0, 170]
var servos = {};

module.exports = {
  init: function() {
    servos = {
      nw: new five.Servo({
        pin: 10,
        range: scalingRange
      }),
      ne: new five.Servo({
        pin: 12,
        range: scalingRange
      }),
      sw: new five.Servo({
        pin: 11,
        range: scalingRange
      }),
      se: new five.Servo({
        pin: 13,
        range: scalingRange
      }),
    }
  },

  applyRotation: function(gamma, beta) {
    var fixedBeta = beta * 3 > 90 ? 90 : beta * 3 < -90 ? -90 : beta * 3;
    var fixedGamma = gamma * 3 > 90 ? 90 : gamma * 3 < -90 ? -90 : gamma * 3;
    var xAxis = (fixedBeta * 1 / 90);
    var yAxis = (fixedGamma * 1 / 90);
    servos.nw.to(this.rotationToServoValue(xAxis + yAxis));
    servos.ne.to(this.rotationToServoValue(xAxis - yAxis));
    servos.sw.to(this.rotationToServoValue(- xAxis + yAxis));
    servos.se.to(this.rotationToServoValue(- xAxis - yAxis));
  },

  rotationToServoValue: function(value) {
    return value * (scalingRange[1] / 2) + (scalingRange[1] / 2);
  }
}

@@ -463,16 +463,101 @@
 ),%0A    %7D
+%0A%0A    servos.nw.min();%0A    servos.ne.min();%0A    servos.sw.min();%0A    servos.se.min();
 %0A  %7D,%0A%0A 

Set initial servos rotation