cylon/examples/test.js

17 lines
402 B
JavaScript
Raw Normal View History

2013-10-23 14:42:16 +08:00
var Cylon = require('..');
2013-10-23 03:33:17 +08:00
// Initialize the robot
2013-10-23 14:42:16 +08:00
var robot = Cylon.robot({
2013-10-23 03:33:17 +08:00
connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
device: { name: 'led', driver: 'led', pin: 13 },
2013-10-23 08:51:36 +08:00
work: function(self) {
2013-10-23 03:33:17 +08:00
// we do our thing here
2013-10-23 08:51:36 +08:00
console.log(self.led.name);
every((1).second(), function() { console.log(self.led.name); });
2013-10-23 03:33:17 +08:00
}
});
// start working
robot.start();