"use strict";
var Cylon = require("cylon");
Cylon
.robot()
.connection({ name: "tessel", adaptor: "tessel", port: "A" })
.device({ name: "servo", driver: "servo-pca9685" })
.on("ready", function(bot) {
var servo1 = 1;
var position = 0;
bot.servo.on("error", function(err) {
console.log(err);
});
bot.servo.configure(servo1, 0.05, 0.12, function() {
setInterval(function() {
console.log("Position (in range 0-1):", position);
bot.servo.move(servo1, position);
position += 0.1;
if (position > 1) {
position = 0;
}
}, 50);
});
});
Cylon.start();