Espruino/code/voice.js
2013-11-06 08:53:47 +00:00

17 lines
382 B
JavaScript

// Espruino bluetooth voice activation
var command = "";
Serial3.onData(function(e) {
command += e.data;
if (e.data==" " || e.data=="\n") {
command="";
} else {
print(command);
if (command=="red") LED1.set();
if (command=="green") LED2.set();
if (command=="blue") LED3.set();
if (command=="off") { LED1.reset(); LED2.reset(); LED3.reset(); }
}
});