Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Created July 31, 2014 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deadprogram/9414ba75cd08624fac51 to your computer and use it in GitHub Desktop.
Save deadprogram/9414ba75cd08624fac51 to your computer and use it in GitHub Desktop.
var Cylon = require('cylon');
Cylon.robot({
connection: [{ name: 'rapiro', adaptor: 'rapiro', port: '/dev/ttyAMA0' },
{ name: 'speech', adaptor: 'speech', voice: 'en-f3' }],
devices: [{name: 'rapiro', driver: 'rapiro', connection: 'rapiro'},
{name: 'mouth', driver: 'speech', connection: 'speech'}],
work: function(my) {
var walking = false ;
var startWalking = function() {
console.log("forward");
my.mouth.say("Ready or not here I come");
walking = true ;
every(1..second(), function() {
if (walking == true) {
my.rapiro.forward();
}
});
}
var stopWalking = function() {
console.log("halt");
my.mouth.say("halt! who goes there!");
walking = false;
my.rapiro.stop();
after(1..second(), function() {
my.rapiro.led(255, 0, 0);
});
}
startWalking();
after(10..seconds(), stopWalking);
}
}).start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment