2013-10-23 05:07:15 +08:00
|
|
|
var cylon = require('..');
|
|
|
|
|
2013-10-23 03:33:17 +08:00
|
|
|
// Initialize the robot
|
|
|
|
var robot = cylon.robot({
|
|
|
|
connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
|
|
|
|
device: { name: 'led', driver: 'led', pin: 13 },
|
2013-10-23 05:07:15 +08:00
|
|
|
|
2013-10-23 03:33:17 +08:00
|
|
|
work: function() {
|
2013-10-23 07:34:27 +08:00
|
|
|
robot = this
|
|
|
|
|
2013-10-23 03:33:17 +08:00
|
|
|
// we do our thing here
|
2013-10-23 07:34:27 +08:00
|
|
|
every((1).second(), function() { console.log(robot.led.name); });
|
2013-10-23 03:33:17 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// start working
|
|
|
|
robot.start();
|