var Spark = require("../lib/spark");
var board = new Spark({
  token: process.env.SPARK_TOKEN,
  deviceId: process.env.SPARK_DEVICE_ID
});

board.on("ready", function() {
  console.log("CONNECTED");

  var pin = "A7";
  var value = 20;

  this.pinMode(pin, this.MODES.SERVO);
  this.servoWrite(pin, value);

  setTimeout(function() {
    this.servoWrite(pin, 160);

    setTimeout(function() {
      console.log( "DONE" );
      process.exit(0);
    }, 750);
  }.bind(this), 750);
});
