"use strict";
var Cylon = require("cylon");
Cylon.robot({
connections: {
tessel: { adaptor: "tessel", port: "A" }
},
devices: {
servo: { driver: "servo-pca9685" }
},
work: function(my) {
var servo1 = 1;
var position = 0;
my.servo.on("error", function(err) {
console.log(err);
});
my.servo.configure(servo1, 0.05, 0.12, function() {
every((0.5).seconds(), function() {
console.log("Position (in range 0-1):", position);
my.servo.move(servo1, position);
position += 0.1;
if (position > 1) {
position = 0;
}
});
});
}
}).start();