Skip to content

Instantly share code, notes, and snippets.

@jonmarkgo
Created June 20, 2012 22:03
Show Gist options
  • Save jonmarkgo/2962502 to your computer and use it in GitHub Desktop.
Save jonmarkgo/2962502 to your computer and use it in GitHub Desktop.
getdigits
function getDigits(call, input) {
console.log('pressed ' + input);
if (arduinoTcp === null) {
call.say("I can't do that for you, Hal. I'm offline.");
} else {
curr_call = call;
if (['2', '4', '5', '6', '8', '0'].indexOf(input) >= 0) {
arduinoTcp.write(input);
call.gather(getDigits, {numDigits: 1});
} else {
call.gather(getDigits, {numDigits: 1}).say("I can't do that for you, Hal. Invalid command.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment